I'm trying to build a web app that grabs fantasy sports info from Yahoo's API. I know that it requires the use of OAuth in order to speak to the API. It's being created using Flask and will run on Google App Engine.
I've been trying to use python-oauth2 from the folks at SimpleGeo and I keep getting the same exact error when trying to do development work. Here's a snippet of code:
import oauth2 as oauth
consumer = oauth.Consumer(key=settings.OAUTH_CONSUMER_KEY, secret=settings.OAUTH_SHARED_SECRET)
request_token_url = "https://api.login.yahoo.com/oauth/v2/get_request_token"
client = oauth.Client(consumer)
resp, content = client.request(request_token_url, "GET")
Here's the error response I'm getting:
{'status': '401', 'transfer-encoding': 'chunked', 'connection': 'close', 'date': 'Tue, 26 Oct 2010 18:24:16 GMT', 'p3p': 'policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"', 'content-type': 'application/x-www-form-urlencoded', 'www-authenticate': 'OAuth oauth_problem=consumer_key_rejected'}
Now, I have read the documentation available via Yahoo and I'm stumped because (a) it seems all so straightforward and (b) I can't figure out where I'm going wrong. I'm using the consumer key and shared secret provided to me by Yahoo.
This is my first experience with OAuth and any help would be greatly appreciated.