Merge pull request #172 from pylast/develop

Prepare for release
This commit is contained in:
Hugo 2016-04-23 17:12:10 +03:00
commit 91bee5b016
4 changed files with 223 additions and 28 deletions

33
.gitignore vendored
View file

@ -1,6 +1,7 @@
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class
# C extensions # C extensions
*.so *.so
@ -8,11 +9,12 @@ __pycache__/
# Distribution / packaging # Distribution / packaging
.Python .Python
env/ env/
bin/
build/ build/
develop-eggs/ develop-eggs/
dist/ dist/
downloads/
eggs/ eggs/
.eggs/
lib/ lib/
lib64/ lib64/
parts/ parts/
@ -22,6 +24,12 @@ var/
.installed.cfg .installed.cfg
*.egg *.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs # Installer logs
pip-log.txt pip-log.txt
pip-delete-this-directory.txt pip-delete-this-directory.txt
@ -30,33 +38,22 @@ pip-delete-this-directory.txt
htmlcov/ htmlcov/
.tox/ .tox/
.coverage .coverage
.coverage.*
.cache .cache
nosetests.xml nosetests.xml
coverage.xml coverage.xml
output.html *,cover
output.xml .hypothesis/
# Translations # Translations
*.mo *.mo
*.pot
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Rope
.ropeproject
# Django stuff: # Django stuff:
*.log *.log
*.pot
# Sphinx documentation # Sphinx documentation
docs/_build/ docs/_build/
# Test files # PyBuilder
test_pylast.yaml target/
lastfm.txt.pkl
secrets.sh
.dir-locals.el

View file

@ -4,7 +4,7 @@
# A Python interface to Last.fm and Libre.fm # A Python interface to Last.fm and Libre.fm
# #
# Copyright 2008-2010 Amr Hassan # Copyright 2008-2010 Amr Hassan
# Copyright 2013-2015 hugovk # Copyright 2013-2016 hugovk
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import six
__version__ = '1.5.1' __version__ = '1.5.1'
__author__ = 'Amr Hassan, hugovk' __author__ = 'Amr Hassan, hugovk'
__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2015 hugovk" __copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2016 hugovk"
__license__ = "apache2" __license__ = "apache2"
__email__ = 'amr.hassan@gmail.com' __email__ = 'amr.hassan@gmail.com'
@ -76,7 +76,8 @@ EVENT_MAYBE_ATTENDING = '1'
EVENT_NOT_ATTENDING = '2' EVENT_NOT_ATTENDING = '2'
PERIOD_OVERALL = 'overall' PERIOD_OVERALL = 'overall'
PERIOD_7DAYS = "7day" PERIOD_7DAYS = '7day'
PERIOD_1MONTH = '1month'
PERIOD_3MONTHS = '3month' PERIOD_3MONTHS = '3month'
PERIOD_6MONTHS = '6month' PERIOD_6MONTHS = '6month'
PERIOD_12MONTHS = '12month' PERIOD_12MONTHS = '12month'
@ -1135,13 +1136,15 @@ class _Request(object):
else: else:
response = self._download_response() response = self._download_response()
return minidom.parseString(_string(response)) return minidom.parseString(_string(response).replace(
"opensearch:", ""))
def _check_response_for_errors(self, response): def _check_response_for_errors(self, response):
"""Checks the response for errors and raises one if any exists.""" """Checks the response for errors and raises one if any exists."""
try: try:
doc = minidom.parseString(_string(response)) doc = minidom.parseString(_string(response).replace(
"opensearch:", ""))
except Exception as e: except Exception as e:
raise MalformedResponseError(self.network, e) raise MalformedResponseError(self.network, e)
@ -1813,8 +1816,8 @@ class _Opus(_BaseObject, _Taggable):
try: try:
lfm = doc.getElementsByTagName('lfm')[0] lfm = doc.getElementsByTagName('lfm')[0]
opus = self._get_children_by_tag_name(lfm, self.ws_prefix).next() opus = next(self._get_children_by_tag_name(lfm, self.ws_prefix))
mbid = self._get_children_by_tag_name(opus, "mbid").next() mbid = next(self._get_children_by_tag_name(opus, "mbid"))
return mbid.firstChild.nodeValue return mbid.firstChild.nodeValue
except StopIteration: except StopIteration:
return None return None
@ -3571,6 +3574,7 @@ class User(_BaseObject, _Chartable):
* period: The period of time. Possible values: * period: The period of time. Possible values:
o PERIOD_OVERALL o PERIOD_OVERALL
o PERIOD_7DAYS o PERIOD_7DAYS
o PERIOD_1MONTH
o PERIOD_3MONTHS o PERIOD_3MONTHS
o PERIOD_6MONTHS o PERIOD_6MONTHS
o PERIOD_12MONTHS o PERIOD_12MONTHS
@ -3591,6 +3595,7 @@ class User(_BaseObject, _Chartable):
* period: The period of time. Possible values: * period: The period of time. Possible values:
o PERIOD_OVERALL o PERIOD_OVERALL
o PERIOD_7DAYS o PERIOD_7DAYS
o PERIOD_1MONTH
o PERIOD_3MONTHS o PERIOD_3MONTHS
o PERIOD_6MONTHS o PERIOD_6MONTHS
o PERIOD_12MONTHS o PERIOD_12MONTHS
@ -3633,6 +3638,7 @@ class User(_BaseObject, _Chartable):
* period: The period of time. Possible values: * period: The period of time. Possible values:
o PERIOD_OVERALL o PERIOD_OVERALL
o PERIOD_7DAYS o PERIOD_7DAYS
o PERIOD_1MONTH
o PERIOD_3MONTHS o PERIOD_3MONTHS
o PERIOD_6MONTHS o PERIOD_6MONTHS
o PERIOD_12MONTHS o PERIOD_12MONTHS

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,6 @@ envlist = py34, py27, pypy, pypy3
recreate = False recreate = False
[testenv] [testenv]
downloadcache = {homedir}/.pipcache
setenv = setenv =
PYLAST_USERNAME={env:PYLAST_USERNAME:} PYLAST_USERNAME={env:PYLAST_USERNAME:}
PYLAST_PASSWORD_HASH={env:PYLAST_PASSWORD_HASH:} PYLAST_PASSWORD_HASH={env:PYLAST_PASSWORD_HASH:}