using requests python code example

Example 1: get requests from python

import requests

response = requests.get('<api-endpoint>')
response.raise_for_status()

data = response.json()
print(data)

Example 2: python print return code of requests

>>> import requests
>>> r = requests.get('http://httpbin.org/status/404')
>>> r.status_code
404

Example 3: python requests get

# pip install requests
import requests
req = requests.get('<url here>', 'html.parser')
print(req.text)

Example 4: python requests

Url = "https://"

r = requests.get( Url )

data = r.json()

Tags: