python library that is the inverse of urllib?
urllib fetches data from urls r开发者_如何转开发ight? is there a python library that can do the reverse of that and send data to urls instead (for example, to a site you are managing)? and if so, is that library compatible with apache?
thanks.
What does sending data to a URL mean? The usual way to do that is just via an HTTP POST, and urllib
(and urllib2
) handle that just fine.
urllib can send data associated with a request by using GET or POST.
urllib2.urlopen(url, data)
where data is a dict of key-values representing the data you're sending. See this link on usage.
Then process that data on the server-side.
If you want to send data any other way, you should use some other protocol such as FTP (see ftplib).
精彩评论