Skip to content

Commit 079824c

Browse files
authored
Merge pull request tobami#266 from wasmerio/patch-1
Fixed python 3 compatibility in github integration
2 parents 8015290 + ce8cac3 commit 079824c

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

codespeed/commits/github.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
from __future__ import absolute_import
99

1010
import logging
11-
import urllib
11+
try:
12+
# Python 3
13+
from urllib.request import urlopen
14+
except ImportError:
15+
# Python 2
16+
from urllib import urlopen
1217
import re
1318
import json
1419

@@ -38,7 +43,7 @@ def fetch_json(url):
3843

3944
if json_obj is None:
4045
try:
41-
json_obj = json.load(urllib.urlopen(url))
46+
json_obj = json.load(urlopen(url))
4247
except IOError as e:
4348
logger.exception("Unable to load %s: %s",
4449
url, e, exc_info=True)

0 commit comments

Comments
 (0)