Septzzz's picture
Upload folder using huggingface_hub (part 15)
ad89e73 verified
Raw
History Blame Contribute Delete
4.2 kB
import requests
import json
from datetime import date, datetime, timedelta
import os
from typing import Optional, Dict, Union, List
def getuserlist(list: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Get paginated list of users. This endpoint is compatible with React AdminOnRest framework to provide DataSource."
"""
url = f"https://auth15.p.rapidapi.com/auth-api/api/users"
querystring = {'list': list, }
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "auth15.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getpublictenantconfig(filter: str=None, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Get tenant public config for front apps"
"""
url = f"https://auth15.p.rapidapi.com/auth-api/api/config"
querystring = {}
if filter:
querystring['filter'] = filter
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "auth15.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getcatalogtenant(is_id: str, filter: str=None, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Get tenant information. Internal endpoint only available to other services."
"""
url = f"https://auth15.p.rapidapi.com/auth-api/api/catalog/tenant/{is_id}"
querystring = {}
if filter:
querystring['filter'] = filter
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "auth15.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getcataloguser(is_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Get user information. Internal endpoint only available to other services."
"""
url = f"https://auth15.p.rapidapi.com/auth-api/api/catalog/user/{is_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "auth15.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def confirm(uid: str, tenant: str, token: str, redirect: bool=None, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Confirm registration. Confirm registraton by providing token sent in e-mail."
"""
url = f"https://auth15.p.rapidapi.com/auth-api/register/{uid}/confirm"
querystring = {'tenant': tenant, 'token': token, }
if redirect:
querystring['redirect'] = redirect
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "auth15.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getuser(is_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Get single user data"
"""
url = f"https://auth15.p.rapidapi.com/auth-api/api/users/{is_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "auth15.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation