pokelance.ext.machine
⚓︎
Machine(client)
⚓︎
Bases: BaseExtension
Extension for machine related endpoints.
Attributes: |
|
---|
Initializes the extension.
Parameters: |
|
---|
Returns: |
|
---|
Source code in pokelance/ext/_base.py
fetch_machine(id_)
async
⚓︎
Fetches a machine from the API.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
Python Console Session
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... machine = await client.machine.fetch_machine(1)
... print(machine.item.name)
... await client.close()
>>> asyncio.run(main())
tm00
Source code in pokelance/ext/machine.py
get_machine(id_)
⚓︎
Gets a machine from the cache.
Parameters: |
|
---|
Returns: |
---|
Raises: |
|
---|
Examples:
Python Console Session
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> machine = client.machine.get_machine(1)
>>> machine.item.name
'tm00'
Source code in pokelance/ext/machine.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
setup()
async
⚓︎
Sets up the extension.