Question #171   Submitted by Answiki on 10/04/2020 at 10:54:57 AM UTC

How to make AJAX request from Python?

Answer   Submitted by Answiki on 01/17/2021 at 06:17:18 PM UTC

AJAX requests can be easily perfomed with the Requests library for Python. The following example make a simple echo request from Postman Echo:

from requests import Session
response = Session().post(
    url='https://postman-echo.com/post',    
    data={ 'foo1': "bar1", 'foo2': "bar2" }
)
print (response.text)

The expected response is a JSON string like:

{'args': {},
 'data': '',
 'files': {},
 'form': {'foo1': 'bar1',
          'foo2': 'bar2'},
 'headers': {'accept': '*/*',
...

3 events in history
Answer by Answiki on 01/17/2021 at 06:17:18 PM

AJAX requests can be easily perfomed with the Requests library for Python. The following example make a simple echo request from Postman Echo:

from requests import Session
response = Session().post(
    url='https://postman-echo.com/post',    
    data={ 'foo1': "bar1", 'foo2': "bar2" }
)
print (response.text)

The expected response is a JSON string like:

{'args': {},
 'data': '',
 'files': {},
 'form': {'foo1': 'bar1',
          'foo2': 'bar2'},
 'headers': {'accept': '*/*',
...

Answer by Answiki on 10/04/2020 at 11:02:28 AM

AJAX requests can be easily perfomed with the Requests library for Python. The following example make a simple echo request from Postman Echo:

from requests import Session
response = Session().post(
    url='https://postman-echo.com/post',    
    data={ 'foo1': "bar1", 'foo2': "bar2" }
)
print (response.text)

The expected response is a JSON string like:

{'args': {},
 'data': '',
 'files': {},
 'form': {'foo1': 'bar1',
          'foo2': 'bar2'},
 'headers': {'accept': '*/*',
...




Question by Answiki 10/04/2020 at 10:54:57 AM
How to make AJAX request from Python?
# ID Query URL Count

Icons proudly provided by Friconix.