Septzzz's picture
Upload folder using huggingface_hub (part 20)
dc960e3 verified
Raw
History Blame Contribute Delete
6.18 kB
import requests
import json
from datetime import date, datetime, timedelta
import os
from typing import Optional, Dict, Union, List
def get_rcard_user_transaction_detail(cardnumber: str, clientid: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"use this request to review all transactions made by an specific user using the card number"
"""
url = f"https://aldenteapi.p.rapidapi.com/card/mvt/client/{clientid}/card/{cardnumber}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_sftrest_overview(sucid: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Branch overview with number of users and total sales"
"""
url = f"https://aldenteapi.p.rapidapi.com/sales/suc/{sucid}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_sftrest_user_summary(sucid: str, cardnumber: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"get specific user summary with visits and transactions"
"""
url = f"https://aldenteapi.p.rapidapi.com/sales/suc/{sucid}/card/{cardnumber}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_sftrest_all_details_by_customer(cardnumber: str, sucid: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Detailed report from a single user for sftrest"
"""
url = f"https://aldenteapi.p.rapidapi.com/sales/det/suc/{sucid}/card/{cardnumber}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def sales_summary(startdate: str, enddate: str, client: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Provides JSON with sales summary per end point"
"""
url = f"https://aldenteapi.p.rapidapi.com/sales/cs/{client}/start/{startdate}/end/{enddate}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_user_per_range_softrest(enddate: str, clientid: str, startdate: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Get user activity per range and stores under same client"
"""
url = f"https://aldenteapi.p.rapidapi.com/sales/users/{clientid}/start/{startdate}/end/{enddate}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def rescard_by_range(enddate: str, clientid: str, startdate: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Provide a list of the rescard db based on a time range"
"""
url = f"https://aldenteapi.p.rapidapi.com/card/{clientid}/start/{startdate}/end/{enddate}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def card_overview_by_client(clientid: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Provides the client overview"
"""
url = f"https://aldenteapi.p.rapidapi.com/card/client/{clientid}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def get_rcard_client_summary(cardnumber: str, clientid: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Get General information about a desired card you will need to provide the card number on the params"
"""
url = f"https://aldenteapi.p.rapidapi.com/card/client/{clientid}/card/{cardnumber}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "aldenteapi.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation