Popular recipes tagged "dropbox"http://code.activestate.com/recipes/tags/dropbox/2016-04-28T13:21:43-07:00ActiveState Code RecipesDropbox file uploader via web interface using Python with urllib2 and mechanize (Python) 2016-04-28T13:21:43-07:00ccpizzahttp://code.activestate.com/recipes/users/4170754/http://code.activestate.com/recipes/578030-dropbox-file-uploader-via-web-interface-using-pyth/ <p style="color: grey"> Python recipe 578030 by <a href="/recipes/users/4170754/">ccpizza</a> (<a href="/recipes/tags/dropbox/">dropbox</a>, <a href="/recipes/tags/mechanize/">mechanize</a>). Revision 7. </p> <p>UPDATE: This is script is not maintained and does not anymore with the current version of Dropbox. For a proper command line interface to dropbox I recommend <code>dropbox_uploader</code>: <a href="https://github.com/andreafabrizi/Dropbox-Uploader" rel="nofollow">https://github.com/andreafabrizi/Dropbox-Uploader</a></p> <p>Originally inspired by the example at <a href="http://joncraton.org/blog/62/uploading-dropbox-python" rel="nofollow">http://joncraton.org/blog/62/uploading-dropbox-python</a>. </p> <p>The script uses mechanize to logon to the web page and upload the file(s) to the Dropbox root folder or to the folder supplied on the command line as <code>dir:/my_dropbox_path</code> (if present, this must be the first parameter).</p> <p>Multiple files and/or glob patterns names are accepted as script arguments.</p> <h5 id="example-usage">Example usage</h5> <pre class="prettyprint"><code>dropbox.py file1.txt # upload to root folder dropbox.py dir:/Backups/2012 file1.txt # upload to custom folder dropbox.py dir:/Backups/2012 *.txt # upload by file mask dropbox.py dir:/Backups/2020 * # upload all files in current dir </code></pre> <p>Limitations: only files in current folder are processed, subfolders are ignored.</p> <h5 id="note">NOTE</h5> <p>The script requires the <code>mechanize</code> module - use <code>pip install mechanize</code> or <code>easy_install mechanize</code> to add it to your site-packages.</p> <h5 id="note2">NOTE2</h5> <p>I have found a cleaner way to manage dropbox files from the console - see the <em>dropbox-uploade</em>r script at <a href="https://github.com/andreafabrizi/Dropbox-Uploader" rel="nofollow">https://github.com/andreafabrizi/Dropbox-Uploader</a> - it is a Bash script that works using the official Dropbox API rather than emulating a web browser.</p>