I want to upload a file from my computer to a file hoster like hotfile.com via a Python script. Because Hotfile is only offering a web-based upload service (no ftp).
I need Python first to login with my username and p开发者_如何转开发assword and after that to upload the file. When the file transfer is over, I need the Download and Delete-link (which is generated right after the Upload has finished).
Is this even possible? If so, can anybody tell me how the script looks like or even give my hints how to build it? Thanks
For a similar task, I've previously used mechanize, with some quite success.
Note: although I was not uploading files, its documentation says that it is capable to handle also file uploads.
Okay, you want to use Python to upload a file using HTTP "put". You will need to use a Python library that lets you do HTML stuff; a good choice might be httplib which is included with Python.
A Google search for "Python HTTP put" found me this:
http://inamidst.com/proj/put/put.py
This appears to be complete working code that solves your problem.
You mention they do not offer FTP, but I went to their site and found the following:
How to upload with FTP? ftp.hotfile.com user: your hotfile username pass: your hotfile password You can upload and make folders, but cant rename,move files
Try it. If it works, using FTP from within Python will be a very simple task.
精彩评论