X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sima%2Flib%2Fsimafm.py;h=08fdbc3fe65e1655273a12cfe6d9d9874dbe7574;hb=caff603bfa12a698d3063ea3489f333d9cafdbf0;hp=04ee37b915386413d6ccd24d00865df8c72b42fd;hpb=00f3a52f35f709dd4c471cb6ad87dbd09cfd4aaf;p=mpd-sima.git diff --git a/sima/lib/simafm.py b/sima/lib/simafm.py index 04ee37b..08fdbc3 100644 --- a/sima/lib/simafm.py +++ b/sima/lib/simafm.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2014 Jack Kaliko +# Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Jack Kaliko # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ Consume EchoNest web service """ -__version__ = '0.0.1' +__version__ = '0.5.0' __author__ = 'Jack Kaliko' @@ -38,7 +38,7 @@ if len(LFM.get('apikey')) == 43: # simple hack allowing imp.reload # Some definitions WAIT_BETWEEN_REQUESTS = timedelta(0, 1) -SOCKET_TIMEOUT = 4 +SOCKET_TIMEOUT = 6 class SimaFM(): @@ -64,7 +64,7 @@ class SimaFM(): self.current_element = SimaFM.cache.get(url).elem return try: - self._fetch_ech(payload) + self._fetch_ws(payload) except Timeout: raise WSTimeout('Failed to reach server within {0}s'.format( SOCKET_TIMEOUT)) @@ -72,7 +72,7 @@ class SimaFM(): raise WSError(err) @Throttle(WAIT_BETWEEN_REQUESTS) - def _fetch_ech(self, payload): + def _fetch_ws(self, payload): """fetch from web service""" req = get(self._url, params=payload, timeout=SOCKET_TIMEOUT)