python - SSL: WRONG_VERSION_NUMBER] 使用代理时版本号错误
问题描述
我正在使用 instauto 使用代理在 Instagram 上发布图片。此外,当我关闭代理时,一切正常。但是,当我打开代理时,它给了我这个错误
ERROR:instauto.api.actions.request:Exception while sending request to https://i.instagram.com/api/v1/zr/token/result/?device_id=android-8cbc4322841e6ac5&token_hash=&custom_device_id=f9c6a86b-8cbc-4322-841e-6ac5d09d5ffc&fetch_reason=token_expired with data:
{}
Traceback (most recent call last):
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\urllib3\connection.py", line 502, in _connect_tls_proxy
ssl_context=ssl_context,
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\urllib3\util\ssl_.py", line 432, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\urllib3\util\ssl_.py", line 474, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Program Files\Python37\lib\ssl.py", line 412, in wrap_socket
session=session
File "C:\Program Files\Python37\lib\ssl.py", line 850, in _create
self.do_handshake()
File "C:\Program Files\Python37\lib\ssl.py", line 1108, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1045)
整个代码是:
from instauto.api.client import ApiClient
from instauto.api import structs as st
from instauto.api.actions import post as ps
if __name__ == '__main__':
if os.path.isfile('./.instauto.save'):
client = ApiClient.initiate_from_file('./.instauto.save')
else:
client = ApiClient(user_name=os.environ.get("INSTAUTO_USER") or "my_username", password=os.environ.get("INSTAUTO_PASS") or "my_password")
client.login()
client.save_to_disk('./.instauto.save')
post = ps.PostFeed(
path='./test_feed.jpg',
caption='This is an example. Follow me!'
)
resp = client.post_post(post, 80)
print("Success: ", resp.ok)
我已经寻找解决这个问题但我失败了:(。此外,我不确定这个问题是来自代理(似乎工作正常)还是 Instagram。
解决方案
推荐阅读
- android - RecyclerView 适配器无法工作
- excel - VBA清除单元格旁边的行内容
- javascript - 使用 javascript / css 的气泡爆炸动画
- architecture - 单体到微服务(涉及哪些任务?)
- laravel - Laravel - SQL查询在多对多关系中等于id的值为null
- cpu-architecture - 基本处理器架构
- selenium-webdriver - 如何在 selenium Web 驱动程序中处理具有相同名称和 id 的表中的多个图像编辑图标
- angularjs - Angular JS 中的路由错误
- javascript - ES6函数解构赋值为对象
- fortran - 错误:f77 程序中有两个主要程序