If I were trying to google something, how would I send the data I want to search to be searched? I know you can add it to the url, but I do not want to do this.
1 Answer
Using the requests library. You would use the .post method in the same way as the .get method. Passing in the data as a dictionary to the data parameter of the function.
The quickstart docs describe it here http://requests.readthedocs.org/en/latest/user/quickstart/#more-complicated-post-requests
If using urllib or urllib2 the data parameter of the urlopen function will POST the data to the page rather than GET it.
see the docs here http://docs.python.org/library/urllib.html#urllib.urlopen
2 Comments
Daniel Roseman
The OP is asking about how to use the "requests" third-party library.
Andrew Cox
oh :) I just thought he meant requests in a general sense.