簡體   English   中英

代理服務器不會使用 Python 請求更改公共 IP

[英]Proxy server doesn't change public IP with Python Requests

我正在運行這個腳本:

import requests

proxyDict = {"http"  : 'http://81.93.73.28:8081'}

r = requests.get('http://ipinfo.io/ip', proxies=proxyDict)
r.status_code
r.headers['content-type']

r.encoding

print(r.text)

我已經嘗試過我自己的代理服務器以及幾個公共服務器。 它仍然打印我當前的 ip。 我究竟做錯了什么?

問題似乎與代理有關。 我用那個代碼嘗試了隨機的、免費的。 此外,您的代碼有一些問題。 您在沒有使用的情況下調用屬性 - 它們沒有必要。 嘗試使用該代碼和代理,對我來說,它有效。

proxyDict = {"http"  : 'http://162.14.18.11:80'}

r = requests.get('http://ipinfo.io/ip', proxies=proxyDict, )
print(r.status_code)

print(r.text)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM