0

401 when using date parameters

Hi,

After getting an oauth token I am able to make calls such as this with no problem:

http://fantasysports.yahooapis.com/fantasy...291/teams/stats

But I get a 401 when I add a date parameter like so:

http://fantasysports.yahooapis.com/fantasy...date=2011-01-12

Full request below:

http://fantasysports.yahooapis.com/fantasy........p2Or12w%3D
Invalid response 401.
<?xml version='1.0' encoding='UTF-8'?>
<yahoo:error xmlns:yahoo='http://yahooapis.com/v1/base.rng'
xml:lang='en-US'>
<yahoo:description>Please provide valid credentials. OAuth oauth_problem="signature_invalid", realm="yahooapis.com"</yahoo:description>
</yahoo:error>
<!-- fan23.sports.ac4.yahoo.com uncompressed/chunked Fri Jan 28 04:23:45 PST 2011 -->

I am using python-oauth2 for my OAuth library.

Any help would be greatly appreciated. Thanks!

by
  • .
  • Jan 28, 2011
3 Replies
  • Er...hm. Well, one thing to fix first: it's "type=date", not "type=day". But I don't think that should be causing your problem? Especially with it returning back a signature invalid message. My only other thoughts would be:

    * The library or your code is incorrectly assuming that the extra parameters are GET parameters, when they're actually part of the URL itself. What does the call look like through the python library you're using?
    * There's some URL encoding issue going on where the semicolons or = signs are not being URL encoded before going into the signature.

    Let me know a bit more about how you're generating the signature, and I can try to think a little bit more (but also go ahead and fix up the "type=date" just to make sure that's not causing any other issues).
    0
    • .
    • Jan 29, 2011
    Genius!

    It appears the urlparse library in python treats semi-colons as GET parameters. As you suspected these weren't being encoded into the signature.

    Hope this helps anyone else that might be using python-oauth2 from simplegeo.

    This OAuth stuff has been a lot trickier than I thought it would be.

    Thanks for the quick response and the super helpful advice. Where would we be w/o you?
    0
  • QUOTE (. @ Jan 29 2011, 12:26 AM) <{POST_SNAPBACK}>
    Genius!

    It appears the urlparse library in python treats semi-colons as GET parameters. As you suspected these weren't being encoded into the signature.

    Hope this helps anyone else that might be using python-oauth2 from simplegeo.

    This OAuth stuff has been a lot trickier than I thought it would be.

    Thanks for the quick response and the super helpful advice. Where would we be w/o you?

    Glad that helped -- heh, that actually was a slightly different problem than I was thinking of, but I'm happy that my random guessing incidentally got you thinking in the right direction. :)
    0

Recent Posts

in Fantasy Sports API