google-code-export / gdata-python-client

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

Can't upload files of any type via the docs client, even though it's now possible to do so #514

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the samples/docs/resumable_upload_sample.py with --convert=false
2. Upload a python script and choose any auth method

What is the expected output? What do you see instead?
Some variation of this is expected:
Uploading FILE ( MIMETYPE ) @ BYTECOUNT...
Uploading bytes: CHUNK/BYTECOUNT
Done: True
Document uploaded: FILE_TITLE
Quota used: 0
file closed: False

but I'm greeted with:

Traceback (most recent call last):
  File "resumable_upload_sample.py", line 221, in <module>
    main()
  File "resumable_upload_sample.py", line 213, in main
    gdata.docs.data.DocsEntry(title=atom.data.Title(text=title)))
  File "resumable_upload_sample.py", line 127, in UploadInManualChunks
    self.uploader._InitSession(uri, entry=new_entry)
  File "/usr/local/lib/python2.6/dist-packages/gdata/client.py", line 939, in _init_session
    http_request=http_request)
  File "/usr/local/lib/python2.6/dist-packages/gdata/client.py", line 320, in request
    RequestError)
gdata.client.RequestError: Server responded with: 403, <errors 
xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>Serv
iceForbiddenException</code><internalReason>You do not have permission to 
perform this operation.</internalReason></error></errors>

What version of the product are you using?
2.0.14

Please provide any additional information below.

The doc list API is supposed to handle files of any type now (as stated here: 
http://googleappsdeveloper.blogspot.com/2011/05/upload-all-file-types-to-any-goo
gle.html ) It is a rather new change, so I don't actually expect this to work, 
instead, I'd like to know why this doesn't work and what changes could be made 
to the library or the script in order to upload files of any type, so I can 
make them :)

Attached is a more verbose output from running the script with the --debug 
option.

Original issue reported on code.google.com by luis.bor...@gtempaccount.com on 10 May 2011 at 5:26

Attachments:

GoogleCodeExporter commented 9 years ago
I am in need of this also. I have tried the demo's tried manually with my own 
script, and the response I get is: 'Convert parameter not implemented yet'

Original comment by emanuel....@nextremlabs.ro on 7 Sep 2011 at 7:09

GoogleCodeExporter commented 9 years ago

Original comment by afs...@google.com on 7 Oct 2011 at 12:24

GoogleCodeExporter commented 9 years ago
Hi,

Running resumableuploadsample with version 2.0.15 installed results in: 

Traceback (most recent call last):
  File "./resumable_upload_sample.py", line 221, in <module>
    main()
  File "./resumable_upload_sample.py", line 204, in main
    convert=convert, ssl=ssl, debug=debug)
  File "./resumable_upload_sample.py", line 84, in __init__
    chunk_size=self.chunk_size, desired_class=gdata.docs.data.DocsEntry)
AttributeError: 'module' object has no attribute 'DocsEntry'

Not surprising really since the demo itself is missing from the 2.0.15 
version...

It would be nice to know when resumable uploads of any file type would be 
available through the python client though. Thanks.

Original comment by juha.ker...@gmail.com on 27 Nov 2011 at 7:32

GoogleCodeExporter commented 9 years ago
I was getting the same error as juha.ker... 

Basically, we replaced the string "gdata.docs.data.DocsEntry" with 
"gdata.data.GDEntry" throughout the program that called "DocsEntry" and that 
fixed the problem.

I blogged about it here:
http://atechyblog.blogspot.com/2012/02/googlecl-docs-upload-fixed-for-gdata.html

Original comment by Coilamg on 2 Feb 2012 at 9:14

GoogleCodeExporter commented 9 years ago
Hi, it is currently possible, but transparently done by the Update or Insert 
methods if you provide the media attribute.

Check this:

http://code.google.com/p/gdata-python-client/source/browse/samples/docs/docs_v3_
example.py

Original comment by afs...@google.com on 2 Feb 2012 at 2:38