feat: added PUT requests inside bling

also made a template for the actions
This commit is contained in:
ka 2024-06-18 01:05:46 -03:00
parent a8c5bedc52
commit 76b2c45270
Signed by: ka
GPG Key ID: 77D32BB1496F3FD1
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import requests
import ajusta_bling.bling as bling
import ajusta_bling.database as database
import ajusta_bling.oauth
def export_products(db: database.Database, oauth: ajusta_bling.oauth):
pass
def export_products_variations(db: database.Database, oauth: ajusta_bling.oauth):
pass

View File

@ -0,0 +1,15 @@
import requests
import ajusta_bling.bling as bling
import ajusta_bling.database as database
import ajusta_bling.oauth as oauth
def import_products(db: database.Database, oauth: oauth.OAuth):
pass
def import_products_variation(db: database.Database, oauth: oauth.OAuth):
pass
def import_products_structure(db: database.Database, oauth: oauth.OAuth):
pass

View File

@ -0,0 +1,5 @@
def modify_product_inventory_type(product_id: int):
pass
def modify_structure_inventory_type(product_id: int):
pass

View File

@ -27,3 +27,19 @@ def get_product_structure(product_id: int) -> any:
except requests.exceptions.RequestException as e:
print(e)
return False
def put_product(product_id: int, data: any) -> any:
try:
request = requests.put("%s/produtos/%s" % (BLING_API_URL, product_id), data=data)
return request.json()['data']
except requests.exceptions.RequestException as e:
print(e)
return False
def put_product_component(product_id: int, data: any) -> any:
try:
request = requests.put("%s/produtos/componentes/%s" % (BLING_API_URL, product_id), data=data)
return request.json()['data']
except requests.exceptions.RequestException as e:
print(e)
return False