Skip to content

Instantly share code, notes, and snippets.

for url in urls:
payload = {
# A URL can be added to a particular product and we need product_id of that.
# Use the product_id you've written down in the previous example.
'product_id': 2055805,
# Just one URL at a time
'url': url
}
urls = [
'https://thelovelystore.com/products/8893774-apple-iphonex-64gb-spacegray',
'https://www.coolblue.nl/product/793610/apple-iphone-x-64gb-zilver.html',
'https://www.apple.nl/shop/buy-iphone/iphone-x/5,8-inch-display-256gb-zilver',
'https://eurogsm.ro/apple-iphone-x-5-8-4g.html'
]
# We are calling /add/product endpoint.
# Since this is a creation method, we use POST (in lowercase) as method.
response = make_request('/add/product', 'post', payload)
print(response.status_code, response.text)
payload = {
# Name of the product
'name': 'iPhone X, GSM Unlocked 5.8", 64 GB - Space Gray',
# Brand (producer, supplier) of the item. You can set it to "No Brand" if you
# like to
'brand': 'Apple',
# A category you pick. It may be a category within your product hierarchy,
# or it can be a separate tag like "Discounted items", "Low traffic" etc.
def make_request(path, method, payload=None):
# Use API Key and API Token that you've copied from
# your settings page.
headers = {
'apikey': 'apidemo@prisync.com',
'apitoken': 'c18888888888888888888fa135f540',
}
# This is the root URL. All API calls are relative to this URL.
base_url = "https://prisync.com/api/v2"