Get A Web Page Via A Post Request In Python

This is an example of how to use the Python `requests` module to send a POST request to a web server that includes headers and a json payload. (The specific example is for a meilisearch server in this case.)

NOTE: I'm pretty sure you need to install `requests` with `pip` or `pip3`. For example:

Note: the results have been locked in so the bearer token can be removed. The code has been set to :eval never to prevent accidentally running it.

#+NAME: listing-1 #+begin_src python :post results_padder(data=*this*) :results output :wrap example :eval never

import requests

url = ''

headers = { 'Authorization': 'Bearer aaaaabbbbbccccccddddddd', 'Content-Type': 'application/json' }

data = { 'q': 'example' }

response =, headers=headers, json=data)

print(f'Status: {response.status_code}') print(f'Returned: {response.json()}')


TODO: Link up other version of getting pages via GET