<s> '''<STR_LIT>''' <EOL> import simplejson as json <EOL> import oauth2 <EOL> import requests <EOL> CONSUMER_KEY = '<STR_LIT>' <EOL> CONSUMER_SECRET = '<STR_LIT>' <EOL> TOKEN = '<STR_LIT>' <EOL> TOKEN_SECRET = '<STR_LIT>' <EOL> def requestData ( location ) : <EOL> '''<STR_LIT>''' <EOL> data = [ ] <EOL> url = '<STR_LIT>' + location + '<STR_LIT:?>' <EOL> consumer = oauth2 . Consumer ( CONSUMER_KEY , CONSUMER_SECRET ) <EOL> oauth_request = oauth2 . Request ( method = "<STR_LIT:GET>" , url = url ) <EOL> oauth_request . update ( <EOL> { <EOL> '<STR_LIT>' : oauth2 . generate_nonce ( ) , <EOL> '<STR_LIT>' : oauth2 . generate_timestamp ( ) , <EOL> '<STR_LIT>' : TOKEN , <EOL> '<STR_LIT>' : CONSUMER_KEY <EOL> } <EOL> ) <EOL> token = oauth2 . Token ( TOKEN , TOKEN_SECRET ) <EOL> oauth_request . sign_request ( oauth2 . SignatureMethod_HMAC_SHA1 ( ) , consumer , token ) <EOL> signed_url = oauth_request . to_url ( ) <EOL> req = requests . get ( signed_url ) <EOL> content = json . loads ( req . content ) <EOL> data . append ( content ) <EOL> return data </s>
