[英]Python requests.get(): How to Print a Message if There is an Internet Connection Error?
[英]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
新手问题,但
我似乎无法获得错误403的号码
如果它在您的浏览器中正常工作,但是从python获取403,我猜您可能有一些代理设置,否则此代码应该可以正常工作。
如果您位于代理之后,则需要配置请求模块以了解它
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.