Cleaned up some folders and small Walmart template changes.
This commit is contained in:
30
Scripts/API_Tests/get_analytics_extracts.py
Normal file
30
Scripts/API_Tests/get_analytics_extracts.py
Normal file
@ -0,0 +1,30 @@
|
||||
import requests
|
||||
from urllib.request import urlretrieve
|
||||
|
||||
# Test for Chubb
|
||||
APIKEY = "RFzu130s451F2eKgm45Ck7gyWZMvGToR6Lmf2k5V"
|
||||
EXTRACT = "47156f3d-277a-4c98-b2ba-732ae364270c"
|
||||
FILEID = "cpxFPY"
|
||||
HEADERS = {
|
||||
"accept": "application/json",
|
||||
"x-api-key": APIKEY
|
||||
}
|
||||
|
||||
def get_latest_extract():
|
||||
url = f"https://analytics.northpass.io/extracts/{EXTRACT}/files/latest"
|
||||
resp = requests.get(url, headers=HEADERS)
|
||||
print(resp.text)
|
||||
data = resp.json()
|
||||
print(data)
|
||||
|
||||
def get_info_and_download():
|
||||
url = f"https://analytics.northpass.io/extracts/{EXTRACT}/files/{FILEID}/download"
|
||||
resp = requests.get(url, headers=HEADERS)
|
||||
data = resp.json()
|
||||
print(data['url'])
|
||||
urlretrieve(data['url'], 'Chubb_MCA.csv.gz')
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_info_and_download()
|
||||
Reference in New Issue
Block a user