user1492032
user1492032

Reputation: 11

Using requests to post data to an html form

I am looking to use python in order to post data to a website form. the website is http://up-to-no-good.appspot.com I know that I need to use post, but I do not know how to get it to actually post. The sample input I would like to send (using the requests module) is:

map     : arena_lumberyard at: 0 x, 0 y, 0 z

players : 21 (33 max)

# userid name uniqueid connected ping loss state # 88 "gza" STEAM_0:0:31273869 30:33 70 0 active # 75 "MasterDovahBeard" STEAM_0:1:41046299 46:08 120 0 active # 101 "Gigs" STEAM_0:0:17483483 04:40 78 0 active

Upvotes: 0

Views: 235

Answers (2)

asciimoo
asciimoo

Reputation: 671

here is an example: requests doc - POST request

you need to create a dictionary with the key/value data and pass it to requests.post()

POST_DATA = {'user_id': 88
            ,'name'   : "gza"
            # ...
            }
content = requests.post('http://example.com/', data=POST_DATA).content

Upvotes: 0

David
David

Reputation: 6561

Use mechanize. This module automates web navigation, forms, buttons, etc..

Upvotes: 1

Related Questions