I am new to Python and I am trying to run the following lines in Python 3.4. The file is downloaded from Yelp.com and is ready-to-use:
url_params = url_params or {}
url = 'http://{0}{1}?'.format(host, path)
consumer = oauth2.Consumer(CONSUMER_KEY, CONSUMER_SECRET)
oauth_request = oauth2.Request(method="GET", url=url, parameters=url_params)
oauth_request.update(
{
'oauth_nonce': oauth2.generate_nonce(),
'oauth_timestamp': oauth2.generate_timestamp(),
'oauth_token': TOKEN,
'oauth_consumer_key': CONSUMER_KEY
}
)
token = oauth2.Token(TOKEN, TOKEN_SECRET)
oauth_request.sign_request(oauth2.SignatureMethod_HMAC_SHA1(), consumer, token)
signed_url = oauth_request.to_url()
print 'Querying {0} ...'.format(url)
In the last line:
print 'Querying {0} ...'.format(url) I get an error message: SyntaxError: invalid syntax