httpclient.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:curious 作者: SunDwarf 项目源码 文件源码
def __init__(self, token: str, *,
                 bot: bool = True,
                 max_connections: int = 10):
        #: The token used for all requests.
        self.token = token

        # Calculated headers
        headers = {
            "User-Agent": self.USER_AGENT,
            "Authorization": "{}{}".format("Bot " if bot else "", self.token)
        }

        self.session = asks.Session(base_location=Endpoints.BASE, endpoint=Endpoints.API_BASE,
                                    connections=max_connections)
        self.headers = headers

        #: The global ratelimit lock.
        self.global_lock = multio.Lock()

        self._rate_limits = weakref.WeakValueDictionary()
        self._ratelimit_remaining = lru(1024)
        self._is_bot = bot
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号