shadowtalker
shadowtalker

Reputation: 13823

Send form data from Tornado HTTPClient

How can I use the fetch method to send multipart form data in a POST request? I don't see this mentioned in the documentation anywhere.

I tried this, but the arguments on the server (HTTPServerRequest.arguments) were empty:

client.fetch(
    '/foo/bar',
    headers={'Content-Type': 'form-data'},
    body=urllib.parse.urlencode({'a': 1, 'b': 2})
)

Upvotes: 1

Views: 941

Answers (1)

Rikki
Rikki

Reputation: 3518

Have a read here: on another StackOverflow question answered

I believe any answer will more or less be similar to the link I've pointed out. The Http method you use should not matter at this point. Most of the issue is about constructing the multipart request.

Upvotes: 1

Related Questions