Browse Source

bugfix - set a proper User-Agent header

pull/11/head
Andrei 8 years ago
parent
commit
b7535790fb
  1. 12
      disco/api/http.py

12
disco/api/http.py

@ -2,9 +2,12 @@ import requests
import random
import gevent
import six
import sys
from holster.enum import Enum
from disco import VERSION as disco_version
from requests import __version__ as requests_version
from disco.util.logging import LoggingClass
from disco.api.ratelimit import RateLimiter
@ -156,9 +159,18 @@ class HTTPClient(LoggingClass):
def __init__(self, token):
super(HTTPClient, self).__init__()
py_version = '{}.{}.{}'.format(
sys.version_info.major,
sys.version_info.minor,
sys.version_info.micro)
self.limiter = RateLimiter()
self.headers = {
'Authorization': 'Bot ' + token,
'User-Agent': 'DiscordBot (https://github.com/b1naryth1ef/disco {}) Python/{} requests/{}'.format(
disco_version,
py_version,
requests_version),
}
def __call__(self, route, args=None, **kwargs):

Loading…
Cancel
Save