Created
May 13, 2020 02:07
-
-
Save jakedowns/ad9ce13078d11086ae5f1b14b4c87565 to your computer and use it in GitHub Desktop.
Ghost Inspector Suite Backup Python Script
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
import requests | |
import os | |
from multiprocessing.pool import ThreadPool | |
API_KEY = "XXX" #Place your API Key here | |
r = requests.get(f"https://api.ghostinspector.com/v1/suites/?apiKey={API_KEY}") | |
def backup_suite(s): | |
resp = requests.get(f"https://api.ghostinspector.com/v1/suites/{s['_id']}/export/json/?apiKey={API_KEY}", stream=True) | |
zname = os.path.join(f"{s['_id']}.zip") | |
zfile = open(zname, 'wb') | |
zfile.write(resp.content) | |
zfile.close() | |
return s['_id'] | |
results = ThreadPool(8).imap_unordered(backup_suite, r.json()['data']) | |
for id in results: | |
print(id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment