Skip to content

Commit 69cdeb7

Browse files
committed
Added pass realname argument when performing User.get_info
Added UK to country codes for geo.py Changed fetch interval to use milliseconds (cherry picked from commit b6e4b0b)
1 parent 6c368bc commit 69cdeb7

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

lastfm/api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class Api(object):
2020
API_ROOT_URL = "http://ws.audioscrobbler.com/2.0/"
2121
"""URL of the webservice API root"""
2222

23-
FETCH_INTERVAL = 1
24-
"""The minimum interval between successive HTTP request, in seconds"""
23+
FETCH_INTERVAL = 200
24+
"""The minimum interval between successive HTTP request, in milliseconds"""
2525

2626
SEARCH_XMLNS = "http://a9.com/-/spec/opensearch/1.1/"
2727

@@ -672,9 +672,9 @@ def _read_url_data(self, opener, url, data = None):
672672
with _lock:
673673
now = datetime.now()
674674
delta = now - self._last_fetch_time
675-
delta = delta.seconds + float(delta.microseconds)/1000000
675+
delta = delta.seconds*1000 + float(delta.microseconds)/1000
676676
if delta < Api.FETCH_INTERVAL:
677-
time.sleep(Api.FETCH_INTERVAL - delta)
677+
time.sleep((Api.FETCH_INTERVAL - delta)/1000)
678678
url_data = opener.open(url, data).read()
679679
self._last_fetch_time = datetime.now()
680680
return url_data

lastfm/geo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ class Country(LastfmBase):
497497
'TZ': 'Tanzania, United Republic of',
498498
'UA': 'Ukraine',
499499
'UG': 'Uganda',
500+
'UK': 'United Kingdom',
500501
'UM': 'United States Minor Outlying Islands',
501502
'US': 'United States',
502503
'UY': 'Uruguay',

lastfm/user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ def get_info(api, name):
485485
user = User(
486486
api,
487487
name = data.findtext('name'),
488+
real_name = data.findtext('realname'),
488489
image = dict([(i.get('size'), i.text) for i in data.findall('image')]),
489490
url = data.findtext('url'),
490491
)

0 commit comments

Comments
 (0)