Last active
December 11, 2015 09:59
-
-
Save shiny/4584041 to your computer and use it in GitHub Desktop.
360Buy Price
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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