Answers for "how to get data from a server in python"

9

how to send get request python

import requests
requests.get("https://www.google.com/")
Posted by: Guest on January-05-2020
3

python http request post json example

>>> import requests
>>> r = requests.post('http://httpbin.org/post', json={"key": "value"})
>>> r.status_code
200
>>> r.json()
{'args': {},
 'data': '{"key": "value"}',
 'files': {},
 'form': {},
 'headers': {'Accept': '*/*',
             'Accept-Encoding': 'gzip, deflate',
             'Connection': 'close',
             'Content-Length': '16',
             'Content-Type': 'application/json',
             'Host': 'httpbin.org',
             'User-Agent': 'python-requests/2.4.3 CPython/3.4.0',
             'X-Request-Id': 'xx-xx-xx'},
 'json': {'key': 'value'},
 'origin': 'x.x.x.x',
 'url': 'http://httpbin.org/post'}
Posted by: Guest on April-29-2020

Code answers related to "how to get data from a server in python"

Python Answers by Framework

Browse Popular Code Answers by Language