Preview:
import requests

def fetch_user_data(api_key, user_id):
    url = f"https://example.com/api/v1/users/{user_id}?api_key={api_key}"
    response = requests.get(url)
    
    if response.status_code == 200:
        return response.json()
    else:
        return None

user_data = fetch_user_data("my_secret_api_key", "12345")
print(user_data)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter