Septzzz's picture
Upload folder using huggingface_hub (part 19)
a77550d verified
Raw
History Blame Contribute Delete
10.6 kB
import requests
import json
from datetime import date, datetime, timedelta
import os
from typing import Optional, Dict, Union, List
def get_records_for_a_zone(zone_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /dns_zones/{zone_id}/dns_records get a list of dns records"
"""
url = f"https://community-bitballoon.p.rapidapi.com/dns_zones/{zone_id}/dns_records"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def delete_a_dns_record(zone_id: str, is_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"DELETE /dns_zones/{zone_id}/dns_records/{id} deletes a record"
"""
url = f"https://community-bitballoon.p.rapidapi.com/dns_zones/{zone_id}/dns_records/{is_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_snippet(site_id: str, snippet_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites/{site_id}/snippets/{snippet_id} get a specific snippet"
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites/{site_id}/snippets/{snippet_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_metadata(site_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites/{site_id}/metadata get the metadata for a site"
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites/{site_id}/metadata"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_users(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /users get a list users you have access to"
"""
url = f"https://community-bitballoon.p.rapidapi.com/users"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_files(site_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites/{site_id}/files will return a list of all the files in the current deploy"
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites/{site_id}/files"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_deploys(site_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites/{site_id}/deploys a list of all deploys"
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites/{site_id}/deploys"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_deploy(site_id: str, deploy_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites/{site_id}/deploys/{deploy_id} a specific deploy"
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites/{site_id}/deploys/{deploy_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_dns_zones(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /dns_zones get a list of DNS zones"
"""
url = f"https://community-bitballoon.p.rapidapi.com/dns_zones"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_sites(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites will return all sites you have access to."
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_site(site: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites/3970e0fe-8564-4903-9a55-c5f8de49fb8b will return the site from its ID GET /sites/www.example.com will return the site matching the domain www.example.com"
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites/{site}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_forms(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /forms will return a list of forms"
"""
url = f"https://community-bitballoon.p.rapidapi.com/forms"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_submissions(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /submissions will return a list of form submissions"
"""
url = f"https://community-bitballoon.p.rapidapi.com/submissions"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_file(site_id: str, path_to_file: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites/{site_id}/files/{path-to-file} returns the file"
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites/{site_id}/files/{path_to_file}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def delete_dns_zone(zone_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"DELETE /dns_zones/{zone_id} delete a dns zone"
"""
url = f"https://community-bitballoon.p.rapidapi.com/dns_zones/{zone_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_snippets(site_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"GET /sites/{site_id}/snippets get a list of snippets specific to this site (a reseller may set global snippets that won't be included in this list)"
"""
url = f"https://community-bitballoon.p.rapidapi.com/sites/{site_id}/snippets"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "community-bitballoon.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation