Adding clean install to repo with project files

This commit is contained in:
AmariBolmer
2024-10-21 18:07:45 -07:00
commit 5fb3049888
15 changed files with 183 additions and 0 deletions

19
poke_sdk/api_client.py Normal file
View File

@@ -0,0 +1,19 @@
import requests
from .exceptions import APIError
class APIClient:
BASE_URL = "https://pokeapi.co/api/v2"
def __init__(self):
pass
def get(self, endpoint):
"""Send a GET request to the specified endpoint."""
url = f"{self.BASE_URL}/{endpoint}"
response = requests.get(url)
if response.status_code != 200:
raise APIError(f"Error fetching data: {response.status_code} - {response.text}")
return response.json()