Last active
April 3, 2024 14:31
-
-
Save kaywoz/1231432095c34cdb3f5c5a401567a45e to your computer and use it in GitHub Desktop.
import healthchecks.io to another via api
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 | |
SOURCE_API_URL = "https://healthchecks.io/api/v1/checks/" | |
TARGET_API_URL = "http://0.0.0.0:8000/api/v1/checks/" | |
SOURCE_PROJECT_READONLY_KEY = "SOURCE_API_KEY_READONLY" | |
TARGET_PROJECT_KEY = "TARGET_API_KEY" | |
r = requests.get(SOURCE_API_URL, headers={"X-Api-Key": SOURCE_PROJECT_READONLY_KEY}) | |
for check in r.json()["checks"]: | |
print("Cloning %s" % check["name"]) | |
requests.post(TARGET_API_URL, json=check, headers={"X-Api-Key": TARGET_PROJECT_KEY}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
totally untested, lol