Hey Soeren,

Sorry for the delay. We're continuing to look into this. It appears to be 
related to the connection between App Engine and the Youtube API, and your 
initial explanation was very helpful in getting this reproduced and 
diagnosed. I hope to have an update soon in this thread to inform you and 
anybody else as to the status of this issue (hopefully resolved soon).

Best wishes,

Nick

On Friday, September 11, 2015 at 4:59:46 PM UTC-4, Nick (Cloud Platform 
Support) wrote:
>
> Hey Soeren,
>
> We're still working to figure this out, so thanks for your patience. I'll 
> update next week with any results.
>
> Best wishes,
>
> Nick
>
> 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/2c7d416b-038e-498f-bd22-c6483ee3cb7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to