I am using youtube api to get contents from a youtube account (with just user feed...without user authentication) on our website. Since yesterday morning, we keep getting:>
While re-building the wheel for youtube api with python, I found what might have caused the X-GData-Key
unrecognizable. This answers @Javierfdr .
Short answer: urllib2
is doing .capitalize()
and .title()
all over and mess up the headers.
There are bunch of those code all over in the urllib2
module. Some in handlers and some in Request
. X-GData-Key
is converted into X-Gdata-Key
(titled, note the lower d), or X-gdata-key
(when capitalized). I had to build a custom HTTPSHandler and a Request object just to comment out the lines.
I'm not sure why they do this, but a long thread talks about this issue in http://bugs.python.org/issue2275 . I guess it didn't make it to python 2.7.
I tried out the requests library, and it didn't mess up it with headers. Hooray :)
Just so that others would not waste their time, or at least have a clue what's happening.
-- edit --
Actually, I found out the RFC states the header field names are case-insensitive, and I couldn't find out any evidence that google doesn't. I was wrong about the statement below, I still don't get any stats :( Sorry to be misleading.
After changing all of them, I finally saw the stats in YouTube API dashboard - always wondered why there was no data until now.