Skip to content

Instantly share code, notes, and snippets.

@jangeador
Forked from raiever/json_SUNAPI.py
Created February 14, 2022 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jangeador/9bf1dfb9f339063775bfe082f6cc95f5 to your computer and use it in GitHub Desktop.
Save jangeador/9bf1dfb9f339063775bfe082f6cc95f5 to your computer and use it in GitHub Desktop.
Get JSON response of SUNAPI
import requests
from requests.auth import HTTPDigestAuth
def get_json(cgi, user, password, headers={'Accept': 'application/json'}):
response = requests.get(cgi, auth=HTTPDigestAuth(user, password), headers)
response_json = response.json()
return response
# in the case of Heatmap, if want to get key values,
# heatmap_response_json['HeatMap'][0].keys()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment