Download JSON Data From An API With Query Parameters In Python

NOTE: This is using requests, it's probably better to use the explicit python library

#!/usr/bin/env python3

import keyring
import json 
import requests

base_url = ''

params = {
    'key': keyring.get_password('password_name', 'account_name'),
    'maxResults': 50,
    'part': 'id,contentDetails,snippet,status',
    'id': 'OLAK5uy_mlSFkDjSZamS7gRlBIgrXMNlNmrHyAxtk' 

response = requests.get(base_url, params=params)
if response.status_code == 200:
    json_data = response.json()
    json_string = json.dumps(json_data, sort_keys=True, indent=2, default=str)
    print(f"Error with status code: {response.status_code}")