retoor 50f52b7281 fix: replace async generator with direct await to handle empty input array in main_async
The previous implementation used an async generator `api.get_rants()` which would raise a `StopAsyncIteration` error when the input array was empty. By switching to `await api.get_rants()` which returns a list, the code now correctly handles the edge case where no rants are available, allowing the for loop to iterate over an empty list without raising an exception.
2024-12-03 02:54:31 +00:00

devRanta

devRanta is an async devrant client written in and for Python. Authentication is only needed for half of the functionality and thus username and password are optional parameters by constructing the main class of this package (Api).

You can find last packages in tar and wheel format here.

Running

make run

Testing

Tests are only made for methods not requireing authentication. I do not see value in mocking requests.

make test

How to use

Implementation:

from devranta.api import Api 

api = Api(username="optional!", password="optional!")

async def list_rants():
    async for rant in api.get_rants():
        print(rant["user_username"], ":", rant["text"])

See tests for examples on how to use.

Todo

  • voting comment
  • edit message
S
Description
Async Python client for devRant developer community.
Readme
980 KiB
Languages
Python 98.1%
Makefile 1.9%