ajusta_bling_py/ajusta_bling/bling/__init__.py

29 lines
946 B
Python
Raw Normal View History

2024-06-18 05:06:51 +02:00
import requests
from ajusta_bling import Database
BLING_API_URL = "https://bling.com.br/Api/v3"
def get_inactive_products(page: int) -> any:
try:
request = requests.get("%s/produtos" % BLING_API_URL, params={"criterio": 3, "pagina": page})
return request.json()['data']
except requests.exceptions.RequestException as e:
print(e)
return False
def get_product_variations(product_id: int) -> any:
try:
request = requests.get("%s/produtos/variacoes/%s" % (BLING_API_URL, product_id))
return request.json()['data']
except requests.exceptions.RequestException as e:
print(e)
return False
def get_product_structure(product_id: int) -> any:
try:
request = requests.get("%s/produtos/estruturas/%s" % (BLING_API_URL, product_id))
return request.json()['data']
except requests.exceptions.RequestException as e:
print(e)
return False