🎉 Initial commit - Hazard Odoo 16 project
- Custom modules: hazard_shopify, hazard_inventory_report, hazard_website - Third-party modules: bi_sql_editor, query_deluxe, sql_request_abstract, l10n_mx_sat_sync_itadmin_ee - Docker setup: Odoo 16 + PostgreSQL 17 - Utility scripts: backup_hazard.sh, update_module.py - Agent configuration: .agents/AGENTS.md - Security: Enterprise modules, credentials, backups and production data excluded via .gitignore
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import csv
|
||||
from collections import defaultdict
|
||||
import xmlrpc.client
|
||||
import requests
|
||||
|
||||
ODOO_URL = 'http://localhost:16001'
|
||||
ODOO_DB = 'hazard_new'
|
||||
ODOO_USER = 'admin'
|
||||
ODOO_PASS = 'admin'
|
||||
|
||||
def get_shopify_credentials():
|
||||
common = xmlrpc.client.ServerProxy(f'{ODOO_URL}/xmlrpc/2/common')
|
||||
uid = common.authenticate(ODOO_DB, ODOO_USER, ODOO_PASS, {})
|
||||
models = xmlrpc.client.ServerProxy(f'{ODOO_URL}/xmlrpc/2/object')
|
||||
config_ids = models.execute_kw(ODOO_DB, uid, ODOO_PASS, 'shopify.config', 'search', [[]])
|
||||
config = models.execute_kw(ODOO_DB, uid, ODOO_PASS, 'shopify.config', 'read', [config_ids[0]], {'fields': ['shop_url', 'access_token']})[0]
|
||||
return config.get('shop_url'), config.get('access_token')
|
||||
|
||||
shop_url, access_token = get_shopify_credentials()
|
||||
headers = {'X-Shopify-Access-Token': access_token, 'Content-Type': 'application/json'}
|
||||
query = """
|
||||
{
|
||||
collection(id: "gid://shopify/Collection/487990952129") {
|
||||
products(first: 250) {
|
||||
edges {
|
||||
node { legacyResourceId title }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
resp = requests.post(f"https://{shop_url}/admin/api/2023-10/graphql.json", headers=headers, json={'query': query})
|
||||
product_titles = [edge['node']['title'] for edge in resp.json()['data']['collection']['products']['edges']]
|
||||
|
||||
print("PRODUCTOS EN LA COLECCIÓN PADEL 78:")
|
||||
for t in product_titles:
|
||||
print(t)
|
||||
Reference in New Issue
Block a user