本文介紹了如何使用帶代理的不和諧 python 機器人?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
需要使用帶有代理(https 或 socks)的不和諧機器人.例如,代理是:192.168.1.1:3125,代理授權是:proxy_login:proxy_pass
Need to use discord bot with proxy (https or socks). For example, proxy is: 192.168.1.1:3125 and proxy autorisation is: proxy_login:proxy_pass
我已經嘗試過這個例子:如何連接不和諧機器人通過代理但它不能.
I already try with this example: how to connect a discord bot through proxy but it can't.
client = discord.Client(proxy=USER_PROXY, proxy_auth=aiohttp.BasicAuth(USER_PROXY_LOGIN, USER_PROXY_PASS))
推薦答案
你需要創建一個 aiohttp.ProxyConnector
并將其作為 connector
傳遞給您的 Client
:
You need to create a aiohttp.ProxyConnector
and pass that as the connector
to your Client
:
from aiohttp import ProxyConnector, BasicAuth
basic_auth = BasicAuth(USER_PROXY_LOGIN, USER_PROXY_PASS)
connector = ProxyConnector(USER_PROXY, proxy_auth=basic_auth)
cient = discord.Client(connector=connector)
作為您鏈接的問題,discord.py 不支持 HTTP 代理,僅支持 HTTPS 代理.
As the question you linked notes, discord.py does not support HTTP proxies, only HTTPS proxies.
這篇關于如何使用帶代理的不和諧 python 機器人?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!