google-code-export / gdata-python-client

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

Update spreadsheet to google docs folder (collection) #574

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have been trying to update spreadsheet to google docs. I was able to do that 
successfully using this piece of code:

a. ms = gdata.data.MediaSource(file_path='temp.xls',    
content_type=gdata.docs.service.SUPPORTED_FILETYPES['XLS'])
b. entry = client.Upload(ms, 'Spreadsheet')

However, now I am trying to upload it directly to a folder (collections)

So, I am trying out this:

c. entry = client.Upload(ms, 
'Spreadsheet',folder_or_uri='/feeds/default/private/full/folder%3A0B36yKIbQUlZkY
TkzZTViYTUtNjk5Mi00ZDc5LWJkZTjA0YzY0ZDU0YWQ1/contents')

But it throws out following error:gdata.service.RequestError: {'status': 400, 
'body': 'Invalid request URI', 'reason': 'Bad Request'}

What steps will reproduce the problem?
1.Loggin into your acct
2.Execute steps (a) and (c) instead of (a) and (b)

What is the expected output? What do you see instead?
Expected Output => file should have been updated to the folder in google docs

What version of the product are you using?
gdata.2.0.14
python 6.2

Please provide any additional information below.

Original issue reported on code.google.com by 24k.gan...@gmail.com on 15 Dec 2011 at 1:36

GoogleCodeExporter commented 9 years ago
Issue 573 has been merged into this issue.

Original comment by afs...@google.com on 17 Dec 2011 at 4:59

GoogleCodeExporter commented 9 years ago
Hi, you should provide a full URI, i.e., including the whole domain name, like 
https://docs.google.com/feeds/default/...

Please confirm that this works.

Original comment by afs...@google.com on 17 Dec 2011 at 9:34

GoogleCodeExporter commented 9 years ago
Thanks for helping me out here. Your suggestion helped. I had to make a couple 
of other changes as well.

Here is the code I am using now. 

uri = 
("https://docs.google.com/feeds/folders/private/full/folder%3A0B36yKIbQUlZTkzZTV
iYTUtNjk5Mi00ZDc5LWJkZTUtNjA0YzY0ZDU0YWQ1")
  ms = gdata.data.MediaSource(file_path='temp.xls', content_type=gdata.docs.service.SUPPORTED_FILETYPES['XLS'])
  entry = client.Upload(ms, file_name,folder_or_uri=uri)

This works for me now. 

Thanks a lot.

Original comment by 24k.gan...@gmail.com on 22 Dec 2011 at 9:10

GoogleCodeExporter commented 9 years ago
Great, I will close this issue then.

Original comment by afs...@google.com on 22 Dec 2011 at 9:34