简体   繁体   中英

python requests.get error message

import requests

number = requests.get("http://chainz.cryptoid.info/cure/api.dws?Key=3972cc3ec73f&q=getbalance&a=BMBGZdp8cB9gi2hgxJFBTyxgUZcL6aw6B")

print number.text

Newbie question but

I can't seems to get the number I get error 403

if it's working in your browser, but getting 403 from python, I'm guessing you may have some proxy setting, otherwise this code should work just fine.

if you are behind a proxy, you need to configure the requests module to know about it

import requests

proxies = {
  "http": "http://10.10.1.10:3128",
  "https": "http://10.10.1.10:1080",
}

requests.get("http://chainz.cryptoid.info/cure/api.dws?Key=3972cc3ec73f&q=getbalance&a=BMBGZdp8cB9gi2hgxJFBTyxgUZcL6aw6B", proxies=proxies)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM