spotifywebapipython.sautils
def
GetUnixTimestampMSFromUtcNow(days: int = 0, hours: int = 0, minutes: int = 0, seconds: int = 0) -> int:
Returns a Unix millisecond timestamp value from the current utc datetime for the difference specified by input arguments.
def
static_init(cls):
Define the decorator used to call an initializer for a class with all static methods. This allows static variables to be initialized one time for the class.
def
export(fn):
Define the decorator used to modify a module's "__all__" variable. This avoids us having to manually modify a module's "__all__" variable when adding new classes.
class
Event:
C# like event processing in Python3.
View Sample Code
# Define the class that will be raising events:
class MyFileWatcher:
def __init__(self):
self.fileChanged = Event() # define event
def watchFiles(self):
source_path = "foo"
self.fileChanged(source_path) # fire event
def log_file_change(source_path): # event handler 1
print "%r changed." % (source_path,)
def log_file_change2(source_path): # event handler 2
print "%r changed!" % (source_path,)
# Define the code that will be handling raised events.
watcher = MyFileWatcher()
watcher.fileChanged += log_file_change2
watcher.fileChanged += log_file_change
watcher.fileChanged -= log_file_change2
watcher.watchFiles()