Skip to content

Instantly share code, notes, and snippets.

@prisync
Created March 20, 2018 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prisync/90e2ca73504df8c70b81534da5639249 to your computer and use it in GitHub Desktop.
Save prisync/90e2ca73504df8c70b81534da5639249 to your computer and use it in GitHub Desktop.
response = make_request('/get/product/id/2055805', 'get')
print(response.text)
product_details = json.loads(response.text)
urls = product_details['urls']
for url in urls:
url_response = make_request('/get/url/id/{}'.format(url), 'get')
print(url_response.text)
url_info = json.loads(url_response.text)
daily_change = float(url_info['change_day'] or 0)
price = float(url_info['price'])
# Let's do the calculation if only the price is available.
if price > 0:
if (daily_change / price * 100) > 10:
print("Discount alert at {}".format(url_info['url']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment