使用代理运行python afk脚本时出错

使用代理运行python afk脚本时出错,python,web,python-requests,script,Python,Web,Python Requests,Script,因此,我尝试编写一个python代码,它将使用一些代理在网站上简单地进行afk。如果我在没有代理的情况下运行代码,它工作得很好,但是当我添加代理时,就会开始向整个终端发送带有错误的垃圾邮件 导入请求 导入时间 r=请求 s=r.会话() 校长1={ “用户代理”:“Mozilla/5.0(Windows NT 6.1)AppleWebKit/537.36(KHTML,如Gecko)Chrome/41.0.2228.0 Safari/537.36” } 代理={ 'http':'http://10

因此,我尝试编写一个python代码,它将使用一些代理在网站上简单地进行afk。如果我在没有代理的情况下运行代码,它工作得很好,但是当我添加代理时,就会开始向整个终端发送带有错误的垃圾邮件

导入请求
导入时间
r=请求
s=r.会话()
校长1={
“用户代理”:“Mozilla/5.0(Windows NT 6.1)AppleWebKit/537.36(KHTML,如Gecko)Chrome/41.0.2228.0 Safari/537.36”
}
代理={
'http':'http://10.10.1.10:3128',
“https”:”http://10.10.1.10:1080',
}
url=”https://reeleesama.xyz"
gotit=r.get(url,headers=headers1,proxies=proxies)
尽管如此:
打印(“Afking…”)
时间。睡眠(1000)
下面是我得到的错误(使用代理运行时):

回溯(最近一次呼叫最后一次):
文件“C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site packages\urllib3\connection.py”,第159行,位于康涅狄格州新州
conn=connection.create\u连接(
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\urllib3\util\connection.py”,第84行,位于create\u connection中
提出错误
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\urllib3\util\connection.py”,第74行,位于create\u connection中
sock.connect(sa)
TimeoutError:[WinError 10060]连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机没有响应
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\urllib3\connectionpool.py”,第667行,在urlopen中
自我准备代理(康涅狄格州)
文件“C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site packages\urllib3\connectionpool.py”,第932行,在代理中
连接
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\urllib3\connection.py”,第309行,在connect中
conn=自我。_new_conn()
文件“C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site packages\urllib3\connection.py”,第171行,位于康涅狄格州新州
提出新的连接错误(
urllib3.exceptions.NewConnectionError::未能建立新连接:[WinError 10060]连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机未能响应而建立的连接失败
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\requests\adapters.py”,第439行,在send中
resp=conn.urlopen(
urlopen中的文件“C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site packages\urlib3\connectionpool.py”,第726行
重试次数=重试次数。增量(
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\urllib3\util\retry.py”,第446行,增量
引发MaxRetryError(_池、url、错误或响应错误(原因))
urllib3.exceptions.MaxRetryError:HTTPSConnectionPool(host='ReleeSama.xyz',port=443):url:/(由ProxyError('无法连接到代理')引起,NewConnectionError(':无法建立新连接:[WinError 10060]连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机没有响应。))
在处理上述异常期间,发生了另一个异常:
回溯(最近一次呼叫最后一次):
文件“c:\Users\Archie\Documents\AFK Script\index.py”,第14行,在
gotit=r.get(url,headers=headers1,proxies=proxies)
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\requests\api.py”,第76行,在get中
返回请求('get',url,params=params,**kwargs)
文件“C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site packages\requests\api.py”,第61行,在请求中
return session.request(method=method,url=url,**kwargs)
文件“C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site packages\requests\sessions.py”,请求中的第542行
resp=自我发送(准备,**发送)
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\requests\sessions.py”,第655行,在send中
r=适配器.send(请求,**kwargs)
文件“C:\Users\Archie\AppData\Local\Programs\Python\39\lib\site packages\requests\adapters.py”,第510行,在send中
raise ProxyError(e,请求=请求)
requests.exceptions.ProxyError:HTTPSConnectionPool(host='RELEESMA.xyz',port=443):url:/(由ProxyError('无法连接到代理')引起的)超过了最大重试次数,NewConnectionError(':未能建立新连接:[WinError 10060]连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机没有响应。))
```

您是否从免费列表中获取代理?
Traceback (most recent call last):
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py", line 84, in create_connection
    raise err
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\connection.py", line 74, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
    self._prepare_proxy(conn)
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 932, in _prepare_proxy
    conn.connect()
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 309, in connect
    conn = self._new_conn()
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x00000052D80DF0A0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 446, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='reeleesama.xyz', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000052D80DF0A0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\Archie\Documents\AFK Script\index.py", line 14, in <module>
    gotit = r.get(url, headers=headers1,proxies=proxies)
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Archie\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 510, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='reeleesama.xyz', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000052D80DF0A0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond')))

```