pokelance.ext.location
⚓︎
Location(client)
⚓︎
Bases: BaseExtension
Extension for location related endpoints.
Attributes: |
|
---|
Initializes the extension.
Parameters: |
|
---|
Returns: |
|
---|
Source code in pokelance/ext/_base.py
fetch_location(name)
async
⚓︎
Fetches a location from the API.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... location = await client.location.fetch_location(1)
... print(location.name)
... await client.close()
>>> asyncio.run(main())
canalave-city
Source code in pokelance/ext/location.py
fetch_location_area(name)
async
⚓︎
Fetches a location area from the API.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... location_area = await client.location.fetch_location_area(1)
... print(location_area.name)
... await client.close()
>>> asyncio.run(main())
canalave-city-area
Source code in pokelance/ext/location.py
fetch_pal_park_area(name)
async
⚓︎
Fetches a pal park area from the API.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... pal_park_area = await client.location.fetch_pal_park_area(1)
... print(pal_park_area.name)
... await client.close()
>>> asyncio.run(main())
forest
Source code in pokelance/ext/location.py
fetch_region(name)
async
⚓︎
Fetches a region from the API.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... region = await client.location.fetch_region(1)
... print(region.name)
... await client.close()
>>> asyncio.run(main())
kanto
Source code in pokelance/ext/location.py
get_location(name)
⚓︎
Gets a location from the cache.
Parameters: |
---|
Returns: |
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> location = client.location.get_location(1)
>>> location.name
'canalave-city'
Source code in pokelance/ext/location.py
get_location_area(name)
⚓︎
Gets a location area from the cache.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> location_area = client.location.get_location_area(1)
>>> location_area.name
'canalave-city-area'
Source code in pokelance/ext/location.py
get_message(case, data)
staticmethod
⚓︎
Gets the error message for a resource not found error.
Parameters: |
---|
Returns: |
|
---|
Source code in pokelance/ext/_base.py
get_pal_park_area(name)
⚓︎
Gets a pal park area from the cache.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> pal_park_area = client.location.get_pal_park_area(1)
>>> pal_park_area.name
'forest'
Source code in pokelance/ext/location.py
get_region(name)
⚓︎
Gets a region from the cache.
Parameters: |
---|
Returns: |
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> region = client.location.get_region(1)
>>> region.name
'kanto'
Source code in pokelance/ext/location.py
setup()
async
⚓︎
Sets up the extension.