Skip to content

Instantly share code, notes, and snippets.

@jakedowns
Created May 13, 2020 02:07
Show Gist options
  • Save jakedowns/ad9ce13078d11086ae5f1b14b4c87565 to your computer and use it in GitHub Desktop.
Save jakedowns/ad9ce13078d11086ae5f1b14b4c87565 to your computer and use it in GitHub Desktop.
Ghost Inspector Suite Backup Python Script
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