Initial commit
This commit is contained in:
20
classes/geobase/geobase.py
Normal file
20
classes/geobase/geobase.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List
|
||||
|
||||
from classes.location import Location
|
||||
|
||||
|
||||
class GeoBase(ABC):
|
||||
@abstractmethod
|
||||
async def get_location(self) -> Location:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def find_location(self) -> List[Location]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def nearby_location(self) -> List[Location]:
|
||||
pass
|
23
classes/geobase/geobase_api.py
Normal file
23
classes/geobase/geobase_api.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from typing import List
|
||||
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from classes.geobase.geobase import GeoBase
|
||||
from classes.location import Location
|
||||
|
||||
# from urllib.parse import urlencode
|
||||
|
||||
|
||||
class GeoBaseAPI(GeoBase):
|
||||
async def get_location(self, session: ClientSession, location_id: int) -> Location:
|
||||
# query = {"geoNameId": location_id, "style": "MEDIUM"}
|
||||
# response = await session.get(f"http://api.geonames.org/get?{urlencode(query)}")
|
||||
pass
|
||||
|
||||
async def find_location(self, session: ClientSession, name: str) -> List[Location]:
|
||||
pass
|
||||
|
||||
async def nearby_location(
|
||||
self, session: ClientSession, lat: float, lon: float, radius: int
|
||||
) -> List[Location]:
|
||||
pass
|
Reference in New Issue
Block a user