kamawanu / googlecode-gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

Invalid Request URI while uploading a pdf document to my google docs using python #687

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have been trying to code to upload a pdf document to my google docs using 
python.

import os.path
import gdata.data
import gdata.acl.data
import gdata.docs.client
import gdata.docs.data
import gdata.sample_util
import gdata.docs.service

client = gdata.docs.service.DocsService()
client.ClientLogin('test@gmail.com', 'passwordhere')

f = open('C:\Users\Rex\PycharmProjects\google\pdf.pdf')
ms = gdata.data.MediaSource(file_handle=f, content_type='application/pdf', 
content_length=os.path.getsize(f.name))
#print os.path.getsize(f.name)
folder = "https://docs.google.com/feeds/default/private/full"

entry = client.Upload(ms, f.name, folder_or_uri= folder + '?ocr=true')

I am getting the below output 

'reason': server_response.reason, 'body': result_body}
gdata.service.RequestError: {'status': 400, 'body': 'Invalid request URI', 
'reason': 'Bad Request'}

And when I access the url https://docs.google.com/feeds/default/private/full 
through my browser getting "Invalid Request URI"

I am using the latest gdata lib.

Please help to fix it.

Cheers
Rex

Original issue reported on code.google.com by rexpsunn...@gmail.com on 1 Jan 2014 at 10:04