Initial commit from monorepo

This commit is contained in:
Ruslan Bakiev
2026-01-07 09:12:35 +07:00
commit 5a5186732b
53 changed files with 3347 additions and 0 deletions

25
exchange/services.py Normal file
View File

@@ -0,0 +1,25 @@
import requests as http_requests
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
class OdooService:
def __init__(self):
self.base_url = f"http://{settings.ODOO_INTERNAL_URL}"
def get_products(self):
"""Получить список всех товаров из Odoo"""
try:
url = f"{self.base_url}/fastapi/products/products"
response = http_requests.get(url, timeout=10)
if response.status_code == 200:
return response.json()
else:
logger.error(f"Error fetching products: {response.status_code}")
return []
except Exception as e:
logger.error(f"Error fetching products from Odoo: {e}")
return []