Skip to content

Commit e84ca6f

Browse files
committed
are travis env vars bytes??
1 parent e849178 commit e84ca6f

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

brawlstats/brawlapi/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def __init__(self, token, session=None, timeout=30, is_async=False, **options):
6565
self.cache = TTLCache(540, 180) # 3 requests/sec
6666
self.ratelimit = [3, 3, 0] # per second, remaining, time until reset
6767

68+
if isinstance(token, bytes):
69+
token = token.decode('utf-8')
6870
self.headers = {
6971
'Authorization': token,
7072
'User-Agent': 'brawlstats/{0} (Python {1[0]}.{1[1]})'.format(self.api.VERSION, sys.version_info),

brawlstats/brawlapi/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ def __init__(self, base_url, version=1):
3636
try:
3737
data = json.loads(urllib.request.urlopen(self.CONSTANTS).read())
3838
except (TypeError, urllib.error.HTTPError, urllib.error.URLError):
39-
self.BRAWLERS = []
39+
self.BRAWLERS = {}
4040
else:
4141
if data:
4242
self.BRAWLERS = {b['tID'].lower(): b['scId'] for b in data['characters'] if b['tID']}
4343
else:
44-
self.BRAWLERS = []
44+
self.BRAWLERS = {}
4545

4646

4747
def bstag(tag):

brawlstats/officialapi/core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def __init__(self, token, session=None, timeout=30, is_async=False, **options):
6565
self.cache = TTLCache(100, 300) # 20 requests/min
6666
self.ratelimit = [20, 20, 0] # per minute, remaining, time until reset
6767

68+
if isinstance(token, bytes):
69+
token = token.decode('utf-8')
6870
self.headers = {
6971
'Authorization': 'Bearer {}'.format(token),
7072
'User-Agent': 'brawlstats/{0} (Python {1[0]}.{1[1]})'.format(self.api.VERSION, sys.version_info),

brawlstats/officialapi/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def __init__(self, base_url, version=1):
2424
try:
2525
data = json.loads(urllib.request.urlopen(self.CONSTANTS).read())
2626
except (TypeError, urllib.error.HTTPError, urllib.error.URLError):
27-
self.BRAWLERS = []
27+
self.BRAWLERS = {}
2828
else:
2929
if data:
3030
self.BRAWLERS = {b['tID'].lower(): b['scId'] for b in data['characters'] if b['tID']}
3131
else:
32-
self.BRAWLERS = []
32+
self.BRAWLERS = {}
3333

3434

3535
def bstag(tag):

0 commit comments

Comments
 (0)