This file contains 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
from os import environ | |
import requests | |
def main(): | |
account_id = environ["SMARTCAT_ACCOUNT_ID"] | |
apikey = environ["SMARTCAT_APIKEY"] | |
base_url = environ["SMARTCAT_BASE_URL"] |
This file contains 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 json | |
from pathlib import Path | |
import httpx | |
with Path("./config.json").open() as f: | |
config = json.load(f) | |
documents_model = [ | |
{ |
This file contains 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 httpx # pip install httpx | |
import typer # pip install typer | |
from rich import print # pip install rich | |
from rich.table import Table # pip install rich | |
def cli( | |
account_id: str = typer.Option(..., envvar="SMARTCAT_ACCOUNT_ID"), | |
apikey: str = typer.Option(..., envvar="SMARTCAT_APIKEY"), | |
base_url: str = typer.Option( |
This file contains 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 json | |
from os import environ | |
from pathlib import Path | |
import requests | |
def main(): | |
account_id = environ["smartcat_account_id"] | |
apikey = environ["smartcat_apikey"] |
This file contains 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 asyncio | |
import json | |
import httpx | |
async def main(): | |
client = httpx.AsyncClient( | |
auth=("Your Account ID", "Your APIKEY",), | |
headers={"Accept": "application/json"}, |
This file contains 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 asyncio | |
import json | |
import logging | |
import httpx | |
from dynaconf import settings | |
logging.basicConfig(level=logging.DEBUG) | |
logger = logging.getLogger(__file__) |
This file contains 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
from lark import Lark, Transformer # pip install lark-parser | |
grammar = r""" | |
%import common.ESCAPED_STRING | |
%import common.WS | |
string: ESCAPED_STRING | |
item: string "=" string [";"] | |
items: item* |