29 lines
946 B
Python
29 lines
946 B
Python
|
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
|