![](/img/trans.png)
[英]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.