Hey Soeren,

I've created a public issue tracker thread 
<https://code.google.com/p/googleappengine/issues/detail?id=12382> to keep 
a more formal track of this rather than just a Groups thread. Follow there 
to find any updates. Best of luck.

On Tuesday, September 1, 2015 at 1:03:52 AM UTC-4, Soeren Balko wrote:
>
> Hi,
>
> I'm running into weird issues with httplib2 when following the 
> instructions for resumable uploads to YouTube (see here: 
> https://developers.google.com/youtube/v3/guides/using_resumable_upload_protocol
> ).
>
> Their very first server roundtrip creates a video resource and returns a 
> "Location" response header, which is the upload URL to send the actual 
> video file. That works well and when I invoke this service using cURL like 
> so:
>
> curl -X POST \
>      --verbose \
>      -H "Authorization: Bearer ..." \
>      -H "Content-Type: application/json; charset=UTF-8" \
>      -H "X-Upload-Content-Type: video/*" \
>      -H "X-Upload-Content-Length: 500" \
>      -d '{"snippet": {"title": "foo"}, "status": {"privacyStatus": 
> "unlisted"}}' \
>      "
> https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet%2Cstatus
> "
>
> ...it works as desired and gives me a HTTP/200 and the aforementioned 
> "Location" response header. I tried to mimic that in a GAE Python app, 
> using the httplib2 library. Here is what I do:
>
> http = httplib2.Http()
> credentials.authorize(http)
>                     
> body = simplejson.dumps({
>
> 'snippet': {
>
> 'title': 'foo',
>
> 'description': 'bar'
>
> },
>
> 'status': {
>
> 'privacyStatus': 'unlisted'
>
> }
>
> })
>                     
> response, content = http.request(
>
> uri = '
> https://www.googleapis.com/upload/youtube/v3/videos?uploadtype=resumable&part=snippet%2Cstatus
> ', 
>
> method = 'POST',
>
> body = body, 
>
> headers = {
>
> 'X-Upload-Content-Length': str(size),
>
> 'X-Upload-Content-Type': 'video/*',
>
> 'Content-Type': 'application/json; charset=UTF-8'
>
> }
>
> )
>
>
> However, that request returns a HTTP/400 with a body that says:
>
>
> {
>
>  "error": {
>
>   "errors": [
>
>    {
>
>     "domain": "global",
>
>     "reason": "badContent",
>
>     "message": "Media type 'application/json; charset=UTF-8' is not 
> supported. Valid media types: [video/*, application/octet-stream]"
>
>    }
>
>   ],
>
>   "code": 400,
>
>   "message": "Media type 'application/json; charset=UTF-8' is not 
> supported. Valid media types: [video/*, application/octet-stream]"
>
>  }
>
> }
>
>
> That doesn't make any sense to me. Somehow, it confuses the "Content-Type" 
> header with that "X-Upload-Content-Type" and I don't know why that is. I 
> tried passing the HTTPS traffic through a HTTP proxy, but httplib2 does not 
> seem to play nicely with the HTTP proxy I use (Charles). 
>
>
> Ideas, anyone?
>
>
> Thanks heaps,
>
> Soeren
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/42d44eb3-44d6-4bce-8818-4c9b178ef714%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to