Hi! My insitute want a simple File share server to exchange file between us. I play with the examples FileLibrary in zope2.6 these days. And suggest to add some keyword or abstract features in FileLibrary will make it a good candidate :) I try to write a python client(not web interface) to upload and download some files in batch. By search on google and python manual, i think it is something to do with httplib. There is a simple demo in python doc of the usage of "POST" method. =================================================
import httplib, urllib params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) headers = {"Content-type": "application/x-www-form-urlencoded", ... "Accept": "text/plain"} conn = httplib.HTTPConnection("musi-cal.mojam.com:80") conn.request("POST", "/cgi-bin/query", params, headers) response = conn.getresponse() print response.status, response.reason 200 OK data = response.read() conn.close() ================================================
But because of my limited knowledge in HTTP and python, i still don't know how to do with a file upload. Anybody can lend me a hand? Thank you! ===== Remote Scensing Satellite Ground Station Chinese Academy of Science _________________________________________________________ Do You Yahoo!? 相见不如聊天!不出门一样面对面!网络摄像头对对派送中~赶快用你的雅虎电邮帐号参与吧…… http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.messenger.yahoo.com/
My insitute want a simple File share server to exchange file between us. I play with the examples FileLibrary in zope2.6 these days. And suggest to add some keyword or abstract features in FileLibrary will make it a good candidate :)
That's an example application, although I don't think there's anything specific to discommend it if it works for you. There are others available. Try searching Zope.org's products listing: there are several document management/file library systems. And of course Plone/CMF.
I try to write a python client(not web interface) to upload and download some files in batch. By search on google and python manual, i think it is something to do with httplib. There is a simple demo in python doc of the usage of "POST" method.
There is a script called site_load.py or some such that comes with Zope that does this using the Zope.app method. If you really want to use httplib, you have to make the value of one of the parameters you send the contents of the file you want to upload, which is probably just as simple as dumping the contents into it. Then treat that parameter as a file on the Zope end and you should be set. (You might try to name the parameter 'name:file' to suggest a type.) If that doesn't work, people on the Python groups/lists should be able to be more helpful as to the use of httplib. Also check zopelabs.com for recipies. --jcc
participants (2)
-
Chen Fu -
J Cameron Cooper