From b7535790fba64b8d4bf0aec1374323de46ce5ec4 Mon Sep 17 00:00:00 2001 From: Andrei Date: Tue, 22 Nov 2016 19:28:28 -0600 Subject: [PATCH] bugfix - set a proper User-Agent header --- disco/api/http.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/disco/api/http.py b/disco/api/http.py index c1c54db..c583bd7 100644 --- a/disco/api/http.py +++ b/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):