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
评论列表
文章目录