Skip to content

Instantly share code, notes, and snippets.

@raiever
Created March 30, 2021 18:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raiever/1ec5543e3c4115510e19902e2a52f5c3 to your computer and use it in GitHub Desktop.
Save raiever/1ec5543e3c4115510e19902e2a52f5c3 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