通过Python脚本上传文件 [英] upload file via python script

查看:473
本文介绍了通过Python脚本上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过一个python脚本从我的电脑的文件上传到像hotfile.com一个filehoster。由于Hotfile只提供基于Web的上传服务(不FTP),我需要先蟒蛇与我的用户名和密码登录,之后上传的文件。当文件传输结束后,我需要下载和删除链接(上传完成后,这是正确的生成)。
这甚至可能?如果是的话,有谁能够告诉我剧本的样子,甚至给我提示如何建立呢?
谢谢

I want to upload a file from my computer to a filehoster like hotfile.com via a python script. Because Hotfile is only offering a webbased-upload service (no ftp) I need python first to login with my username and password and after that to upload the file. When the Filetransfer 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

推荐答案

好吧,你想使用Python上传使用HTTP文件放。您将需要使用一个Python库,可以让你做的东西HTML;一个不错的选择可能是 httplib的其中包括在Python。

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.

一个谷歌搜索Python的HTTP把发现了我这一点:

A Google search for "Python HTTP put" found me this:

http://inamidst.com/proj/put/put.py

这似乎是完整的工作code能解决你的问题。

This appears to be complete working code that solves your problem.

这篇关于通过Python脚本上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆