Skip to content
This repository was archived by the owner on Jun 29, 2023. It is now read-only.

Commit 5e476ad

Browse files
committed
now python3 compatible. and using requests. cos' its beautiful.
1 parent 82f283a commit 5e476ad

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

mvg/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22

3-
import urllib2
3+
import requests
44
import json
55
import datetime
66
from time import mktime
@@ -14,10 +14,8 @@
1414

1515

1616
def _perform_api_request(url):
17-
opener = urllib2.build_opener()
18-
opener.addheaders = [('X-MVG-Authorization-Key', api_key)]
19-
response = opener.open(url)
20-
return json.loads(response.read())
17+
resp = requests.get(url, headers={'X-MVG-Authorization-Key': api_key})
18+
return resp.json()
2119

2220

2321
def _convert_time(time):

0 commit comments

Comments
 (0)