Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52563

question about posting data using MultipartPostHandler

Newsgroups comp.lang.python
Date 2013-08-15 11:12 -0700
Message-ID <3c256548-5fed-446a-8683-b66abc0e301f@googlegroups.com> (permalink)
Subject question about posting data using MultipartPostHandler
From cerr <ron.eggler@gmail.com>

Show all headers | View raw


Hi,

I want to use http post to upload data to a webserver but I want to pass multiple arguments within the post i.e.
I know that you can load one item (data)in there like this:
			data = {"data":open(filename,"rb")}
			response = opener.open(url, data, timeout=TIMEOUT)
but now I want multiple so I tried this:
        multipart = ({"data":data}, {"fname":fname}, {"f":f})
        response = opener.open(url, multipart, timeout=TIMEOUT)

but I get an error saying "'tuple' object has no attribute 'items'"... how do I do this correctly?

Thank you!
Ron

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

question about posting data using MultipartPostHandler cerr <ron.eggler@gmail.com> - 2013-08-15 11:12 -0700
  Re: question about posting data using MultipartPostHandler Chris Angelico <rosuav@gmail.com> - 2013-08-16 01:45 +0100

csiph-web