Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
astelmach01 authored Jul 25, 2023
2 parents 90549da + d2fca79 commit 9c716be
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 129 deletions.
1 change: 0 additions & 1 deletion codeboxapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@
"CodeBox",
"set_api_key",
"settings",
"aiosession"
]
2 changes: 1 addition & 1 deletion codeboxapi/box/basebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BaseBox(ABC):
"""

def __init__(self) -> None:
self.id = uuid4().int
self.id: int | None = None
self.last_interaction = datetime.now()

def _update(self) -> None:
Expand Down
23 changes: 16 additions & 7 deletions codeboxapi/box/codebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.session: Optional[ClientSession] = None

def start(self) -> CodeBoxStatus:
return self.status()

async def astart(self) -> CodeBoxStatus:
self.session = ClientSession()
return await self.astatus()

def codebox_request(
self,
method,
Expand Down Expand Up @@ -63,6 +56,22 @@ async def acodebox_request(
*args, **kwargs
)

def start(self) -> CodeBoxStatus:
self.id = base_request(
method="GET",
endpoint="/codebox/start",
)["id"]
return CodeBoxStatus(status="started")

async def astart(self) -> CodeBoxStatus:
self.session = ClientSession()
self.id = (await abase_request(
self.session,
method="GET",
endpoint="/codebox/start",
))["id"]
return CodeBoxStatus(status="started")

def status(self):
return CodeBoxStatus(
** self.codebox_request(
Expand Down
2 changes: 1 addition & 1 deletion codeboxapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dotenv import load_dotenv

# .env file
load_dotenv()
load_dotenv("./.env")


class CodeBoxSettings(BaseSettings):
Expand Down
Loading

0 comments on commit 9c716be

Please sign in to comment.