A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/117249.html below:

pickled objects over http

pickled objects over httpdsavitsk dsavitsk at e-coli.net
Mon Apr 9 23:30:32 EDT 2001
hello again:
i am trying to run scripts on an http server (iis) which produces pickled
objects to be returned.  everything is okay (the scripts run and when the
pickles are viewed in a browser they look like pickles in text files),
except i am unable to figure out how to unpickle them once gotten.

here is the cgi script ...

------------------------------------
import pickle
def test():
    x = {}
    x['name'] = 'doug'
    x['id'] = '123456789'
    a = pickle.dumps(x)
    return a
print "Content-Type: text/plain\n\n"
print
print str(test())
------------------------------------

and a client ...

------------------------------------
import httplib
import pickle
h = httplib.HTTP('server')
h.putrequest('GET', '/path/to/script.cgi')
h.putheader('Accept', 'text/plain')
h.endheaders()
a,b,c=h.getreply()
f = h.getfile()
x = pickle.loads(f.read())
print x['name']
------------------------------------

can anyone help me to do this?
thanks,
doug



More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4