Last active
August 16, 2016 20:53
-
-
Save TylerMills/68145344fb11b8db9a96a3c13cdbf5b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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