def get_url(shopify_settings):
	last_order_id = shopify_settings.last_order_id

	if not last_order_id:
		if shopify_settings.sync_based_on == 'Date':
			url = get_shopify_url("admin/api/2020-10/orders.json?limit=250&created_at_min={0}&since_id=0".format(
				get_datetime(shopify_settings.from_date)), shopify_settings)
		else:
			url = get_shopify_url("admin/api/2020-10/orders.json?limit=250&since_id={0}".format(
				shopify_settings.from_order_id), shopify_settings)
	else:
		url = get_shopify_url("admin/api/2020-10/orders.json?limit=250&since_id={0}".format(last_order_id), shopify_settings)

	return url
Example #2
0
def sync_item_from_shopify(shopify_settings, item):
	url = get_shopify_url("/admin/products/{0}.json".format(item.get("product_id")), shopify_settings)
	session = get_request_session()

	try:
		res = session.get(url, headers=get_header(shopify_settings))
		res.raise_for_status()

		shopify_item = res.json()["product"]
		make_item(shopify_settings.warehouse, shopify_item)
	except Exception as e:
		raise e
Example #3
0
def sync_item_from_shopify(shopify_settings, item):
	url = get_shopify_url("admin/api/2021-04/products/{0}.json".format(item.get("product_id")), shopify_settings)
	session = get_request_session()

	try:
		res = session.get(url, headers=get_header(shopify_settings))
		res.raise_for_status()

		shopify_item = res.json()["product"]
		make_item(shopify_settings.warehouse, shopify_item)
	except Exception as e:
		raise e