From b4e332b52536f0493de4e7958e7f6170db1e6162 Mon Sep 17 00:00:00 2001 From: Thomas van der Meer Date: Fri, 22 Nov 2024 14:40:39 +0100 Subject: [PATCH] add readme --- README.md | 9 +++++++++ helper.py | 16 ++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e69de29..e4e048d 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,9 @@ +for cloning: `git config --global http.sslverify false` +for installing the environment, install uv -> `pip install uv` +after that, create an environment `uv venv` +install the packages by running `uv sync` + +create an .env file by running `touch .env` +add the following line: `TOGETHER_API_KEY=` +if you don't have it, please ask me :) + diff --git a/helper.py b/helper.py index d611664..c2b67f5 100644 --- a/helper.py +++ b/helper.py @@ -1,21 +1,25 @@ # Add your utilities or helper functions to this file. import os +import json from dotenv import load_dotenv, find_dotenv -# these expect to find a .env file at the directory above the lesson. # the format for that file is (without the comment) # API_KEYNAME=AStringThatIsTheLongAPIKeyFromSomeService + def load_env(): _ = load_dotenv(find_dotenv()) + def save_world(world, filename): - with open(filename, 'w') as f: + with open(filename, "w") as f: json.dump(world, f) + def load_world(filename): - with open(filename, 'r') as f: + with open(filename, "r") as f: return json.load(f) + def get_together_api_key(): - load_env() - together_api_key = os.getenv("TOGETHER_API_KEY") - return together_api_key \ No newline at end of file + load_env() + together_api_key = os.getenv("TOGETHER_API_KEY") + return together_api_key