feat: added PUT requests inside bling
also made a template for the actions
This commit is contained in:
parent
a8c5bedc52
commit
76b2c45270
12
ajusta_bling/actions/exporting.py
Normal file
12
ajusta_bling/actions/exporting.py
Normal 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
|
15
ajusta_bling/actions/importing.py
Normal file
15
ajusta_bling/actions/importing.py
Normal 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
|
5
ajusta_bling/actions/modifying.py
Normal file
5
ajusta_bling/actions/modifying.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
def modify_product_inventory_type(product_id: int):
|
||||
pass
|
||||
|
||||
def modify_structure_inventory_type(product_id: int):
|
||||
pass
|
|
@ -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
|
Loading…
Reference in New Issue
Block a user