This commit is contained in:
Amr Hassan 2009-05-12 13:27:40 +00:00
parent d9148ac382
commit 3a6d7d9fb1

View file

@ -21,7 +21,7 @@
# http://code.google.com/p/pylast/ # http://code.google.com/p/pylast/
__name__ = 'pylast' __name__ = 'pylast'
__version__ = '0.3.3' __version__ = '0.3.4'
__revision__ = "$Revision$" __revision__ = "$Revision$"
__doc__ = 'A Python interface to Last.fm' __doc__ = 'A Python interface to Last.fm'
__author__ = 'Amr Hassan' __author__ = 'Amr Hassan'
@ -29,6 +29,9 @@ __copyright__ = "Copyright (C) 2008-2009 Amr Hassan"
__license__ = "gpl" __license__ = "gpl"
__email__ = 'amr.hassan@gmail.com' __email__ = 'amr.hassan@gmail.com'
# Default values for Last.fm.
WS_SERVER = ('ws.audioscrobbler.com', '/2.0/')
SUBMISSION_SERVER = "http://post.audioscrobbler.com:80/"
__proxy = None __proxy = None
__proxy_enabled = False __proxy_enabled = False
@ -43,7 +46,7 @@ import threading
from xml.dom import minidom from xml.dom import minidom
import os import os
import time import time
from logging import * from logging import info, warn, debug
STATUS_INVALID_SERVICE = 2 STATUS_INVALID_SERVICE = 2
STATUS_INVALID_METHOD = 3 STATUS_INVALID_METHOD = 3
@ -133,8 +136,8 @@ class _ThreadedCall(threading.Thread):
class _Request(object): class _Request(object):
"""Representing an abstract web service operation.""" """Representing an abstract web service operation."""
HOST_NAME = 'ws.audioscrobbler.com' global WS_SERVER
HOST_SUBDIR = '/2.0/' (HOST_NAME, HOST_SUBDIR) = WS_SERVER
def __init__(self, method_name, params, api_key, api_secret, session_key = None): def __init__(self, method_name, params, api_key, api_secret, session_key = None):
@ -3123,7 +3126,8 @@ class Scrobbler(object):
"v": self.client_version, "u": self.username, "t": timestamp, "v": self.client_version, "u": self.username, "t": timestamp,
"a": token} "a": token}
response = _ScrobblerRequest("http://post.audioscrobbler.com:80/", params).execute().split("\n") global SUBMISSION_SERVER
response = _ScrobblerRequest(SUBMISSION_SERVER, params).execute().split("\n")
self.session_id = response[1] self.session_id = response[1]
self.nowplaying_url = response[2] self.nowplaying_url = response[2]