Skip to content

Instantly share code, notes, and snippets.

@TylerMills
Last active August 16, 2016 20:53
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 TylerMills/68145344fb11b8db9a96a3c13cdbf5b0 to your computer and use it in GitHub Desktop.
Save TylerMills/68145344fb11b8db9a96a3c13cdbf5b0 to your computer and use it in GitHub Desktop.
# author: Tyler Mills
import requests
import json
# add user name and password
username = ''
password = ''
# monitor you want to get data from
monitor = '3735007902'
# date range
start = "2015-01-01"
end = "2020-01-01"
endpoint = 'https://api.crimsonhexagon.com/api/'
# will be generated automatically based on credentials above
auth = ''
def auth():
url = endpoint + "authenticate"
querystring = {
"username":username,
"password":password,
"noExpiration":"true"
}
headers = {}
response = requests.request("GET", url, headers=headers, params=querystring)
response = json.loads(response.text)
global auth
auth = response.get('auth')
def crimson():
url = "https://api.crimsonhexagon.com/api/monitor/posts"
querystring = {
"auth":auth ,
"id":monitor,
"start":start,
"end":end,
"filter":"",
"extendLimit":"false",
"fullContents":"true",
"geotagged":"true"
}
headers = {}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
auth()
crimson()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment