在使用python请求时服务器检测到原始IP,但在使用cu时没有检测到

2024-04-26 21:39:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图通过代理服务器向这个URLhttps://verify-email.org/home/verify-as-guest/example@example.com发送请求。你知道吗

我在这里获得了代理服务器: https://free-proxy-list.net/

验证电子邮件网站每小时免费验证5封电子邮件。你知道吗

当我使用代理服务器时,如果我不断更改代理服务器,我可以绕过这个限制。这在我使用curl时有效:

curl --proxy http://IP:PORT https://verify-email.org/home/verify-as-guest/example@example.com

上面的命令非常有效。你知道吗

但是,当我在python中执行同样的操作时:

import requests
from pprint import pprint

def check_email(email):
    proxyDict = { 
                  "http"  : 'http://IP:PORT'
                }

    result = requests.get('https://verify-email.org/home/verify-as-guest/' + email, proxies=proxyDict, timeout=5).json()
    pprint(result)

check_email('example@example.com')

它不起作用。它只给了我5次尝试,然后停止工作,即使我改变了IP,这让我相信curl发送的请求和requests发送的请求是不同的。你知道吗

有什么方法可以在python请求中获得相同的“curl”请求吗?你知道吗


Tags: httpsorgipcomhttphomeexampleemail