title: Upload file to google drive from raspberry pi
body: <p>I am working on capturing image from USB Webcam using mjpg-streamer and its working fine now. For next state i wan to compress all image captured and send it to google drive but i have no idea how to do it. </p>
  
  <p>Currently I am trying 1 example written in python from this <a href="http://shadowbadger.wordpress.com/2012/04/11/uploading-deleting-bypassing-the-bin-and-searching-for-documents-on-google-docs-with-python-gdata/" rel="nofollow noreferrer" title="click here for updates">link</a>. 
  When i try to upload_doc using:  </p>
  
  <pre><code>upload_doc = client.CreateResource(doc, create_uri=create_uri, media=media)
  </code></pre>
  
  <p>I get following error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "./test.py", line 38, in &lt;module&gt;
  upload_doc = client.CreateResource(doc, create_uri=create_uri, media=media)
  File "/usr/local/lib/python2.7/dist-packages/gdata/docs/client.py", line 300, in create_resource
  return uploader.upload_file(create_uri, entry, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 1085, in upload_file
  start_byte, self.file_handle.read(self.chunk_size))
  File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 1044, in  upload_chunk
  raise error
  gdata.client.RequestError: Server responded with: 400,
  </code></pre>
  
  <p><strong>[EDIT]</strong> I was able to upload a zip file to google drive, sorry for my silly mistake. I didn't stated the right path for the folder.</p>
  
  <pre><code>DOC_TITLE='a.jpg.tar'
  LOCAL_FILE='/home/Desktop/webserver-cam/a.jpg.tar'
  doc = gdata.docs.data.Resource(type='document', title=DOC_TITLE)
  media = gdata.data.MediaSource()
  media.SetFileHandle(LOCAL_FILE, 'application/octet-stream')
  create_uri = gdata.docs.client.RESOURCE_UPLOAD_URI + '?convert=false'
  upload_doc = client.CreateResource(doc, create_uri=create_uri, media=media)
  </code></pre>