Py学习  »  Python

当使用python请求而不是curl时,服务器检测到原始ip

Phoenix • 5 年前 • 2011 次点击  

我正在尝试向此URL发送请求 https://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发送的请求和请求发送的请求有区别。

有什么方法可以在Python请求中得到相同的“卷曲”请求吗?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/43597
 
2011 次点击  
文章 [ 1 ]  |  最新文章 5 年前
drew010
Reply   •   1 楼
drew010    6 年前

这个 proxyDict 仅包含用于不安全http请求的代理,但服务正在使用 https

尝试

proxyDict = { 
    "http"  : 'http://IP:PORT',
    "https" : 'http://IP:PORT',
}