Latest recipes tagged "mechanize"http://code.activestate.com/recipes/tags/mechanize/new/2016-04-28T13:21:43-07:00ActiveState Code RecipesLibgen Epub Upload using Tor (Python) 2015-12-06T19:23:54-08:00fuji239http://code.activestate.com/recipes/users/4193238/http://code.activestate.com/recipes/579134-libgen-epub-upload-using-tor/ <p style="color: grey"> Python recipe 579134 by <a href="/recipes/users/4193238/">fuji239</a> (<a href="/recipes/tags/beautifulsoup/">beautifulsoup</a>, <a href="/recipes/tags/libgen/">libgen</a>, <a href="/recipes/tags/mechanize/">mechanize</a>, <a href="/recipes/tags/tor/">tor</a>, <a href="/recipes/tags/upload/">upload</a>). Revision 2. </p> <p>This script shows how to upload epub files in Library Genesys (libgen) automatically by using Tor. Please note that only copyright free epubs should be used (such as those present in <a href="https://www.gutenberg.org/" rel="nofollow">https://www.gutenberg.org/</a>). It will also check if MD5 hash is present before uploading. This is provided for python educative purposes only : it shows how to use a Tor proxy, Mechanize (for uploading and form processing), Hashlib for MD5 calculation, Filemagic for mimetype detecting and BeautifulSoup for response analyzing, all together.</p> Dropbox 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>