Septzzz's picture
Upload folder using huggingface_hub (part 20)
dc960e3 verified
Raw
History Blame Contribute Delete
5.56 kB
import requests
import json
from datetime import date, datetime, timedelta
import os
from typing import Optional, Dict, Union, List
def gettransactionsbyaccount(is_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"To get transactions by account."
id: (Required)
"""
url = f"https://virtual-accounts-api.p.rapidapi.com/api/v1/accountsrvc/virtualaccounts/transactions/account/{is_id}/all"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "virtual-accounts-api.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getbyaccountnumber(accountnumber: int, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"To get a virtual account by account number."
accountnumber: (Required)
"""
url = f"https://virtual-accounts-api.p.rapidapi.com/api/v1/accountsrvc/virtualaccounts/accounts/getbyaccountnumber/{accountnumber}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "virtual-accounts-api.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getallcurrencies(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"To get all currencies. It's needed for the create virtual account endpoint."
"""
url = f"https://virtual-accounts-api.p.rapidapi.com/api/v1/accountsrvc/virtualaccounts/currencies/all"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "virtual-accounts-api.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getalltransactions(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"To get all transactions in organisation."
"""
url = f"https://virtual-accounts-api.p.rapidapi.com/api/v1/accountsrvc/virtualaccounts/transactions/all"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "virtual-accounts-api.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def gettransactionbyid(is_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"To get transaction by unique id."
id: (Required)
"""
url = f"https://virtual-accounts-api.p.rapidapi.com/api/v1/accountsrvc/virtualaccounts/transactions/{is_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "virtual-accounts-api.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getchannelbyid(is_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"To get a channel."
id: (Required)
"""
url = f"https://virtual-accounts-api.p.rapidapi.com/api/v1/accountsrvc/virtualaccounts/channels/{is_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "virtual-accounts-api.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getaccountbyid(is_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"To get a single virtual account."
id: (Required)
"""
url = f"https://virtual-accounts-api.p.rapidapi.com/api/v1/accountsrvc/virtualaccounts/accounts/{is_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "virtual-accounts-api.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def getallaccounts(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"To get all virtual accounts in your organisation."
"""
url = f"https://virtual-accounts-api.p.rapidapi.com/api/v1/accountsrvc/virtualaccounts/accounts/all"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "virtual-accounts-api.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation