Last active
January 17, 2017 15:50
-
-
Save paramsingh/a4764b16afd290f577e00bade51ef5ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import requests | |
api_key = 'APIKEY' | |
api_sig = 'fdjakl' | |
payload = {'api_key': api_key, 'api_sig': api_sig} | |
x = payload.copy() | |
x['token'] = token | |
x['sk'] = sk | |
x['method'] = 'track.scrobble' | |
x['artist[0]'] = 'Drake' | |
x['track[0]'] = 'Cameras / Good Ones Go (Interlude)' | |
x['timestamp[0]'] = str(int(time.time())) | |
x['album[0]'] = 'Take Care' | |
r = requests.post('http://localhost:8000/2.0/", data = x) | |
print(r.status_code) | |
f = open('out', 'w') | |
print(r.text, file = f) | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__ | |
return self.wsgi_app(environ, start_response) | |
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app | |
response = self.make_response(self.handle_exception(e)) | |
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception | |
reraise(exc_type, exc_value, tb) | |
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app | |
response = self.full_dispatch_request() | |
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request | |
rv = self.handle_user_exception(e) | |
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception | |
reraise(exc_type, exc_value, tb) | |
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request | |
rv = self.dispatch_request() | |
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request | |
return self.view_functions[rule.endpoint](**req.view_args) | |
File "/code/listenbrainz/webserver/rate_limiter.py", line 145, in rate_limited | |
return f(*args, **kwargs) | |
File "/code/listenbrainz/webserver/views/api_compat.py", line 87, in api_methods | |
return record_listens(request, data) | |
File "/code/listenbrainz/webserver/views/api_compat.py", line 271, in record_listens | |
augmented_listens = insert_payload(native_payload, str(session.user.id), listen_type=listen_type) | |
File "/code/listenbrainz/webserver/views/api_tools.py", line 49, in insert_payload | |
return augmented_listens | |
UnboundLocalError: local variable 'augmented_listens' referenced before assignment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment