Skip to content

Instantly share code, notes, and snippets.

@shiny
Last active December 11, 2015 09:59
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 shiny/4584041 to your computer and use it in GitHub Desktop.
Save shiny/4584041 to your computer and use it in GitHub Desktop.
360Buy Price
import requests
import re
def fetch_jd_price(id):
s = requests.Session()
buy_url = 'http://gate.360buy.com/InitCart.aspx?pid='+str(id)+'&pcount=1&ptype=1'
status_url = 'http://cart.360buy.com/cart/miniCartServiceNew.action?'+\
'callback=jsonp&_=1358748376993&method=GetCart'
s.get(buy_url)
r = s.get(status_url)
match = re.search(r',"TotalPromotionPrice":(\d+\.\d+),',r.text)
return match.group(1)
print(fetch_jd_price(268077))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment