https://github.com/sas2k/xkcd-python
A wrapper for xkcd.com api built with python
https://github.com/sas2k/xkcd-python
library python wrapper wrapper-api xkcd xkcd-api
Last synced: about 1 year ago
JSON representation
A wrapper for xkcd.com api built with python
- Host: GitHub
- URL: https://github.com/sas2k/xkcd-python
- Owner: Sas2k
- License: mit
- Created: 2022-06-22T06:40:11.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-14T15:01:16.000Z (over 3 years ago)
- Last Synced: 2025-06-02T08:27:08.687Z (about 1 year ago)
- Topics: library, python, wrapper, wrapper-api, xkcd, xkcd-api
- Language: Python
- Homepage: https://pypi.org/project/xkcd-python/
- Size: 38.1 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xkcd-python


xkcd-python is an API wrapper for xkcd.com written in python.
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install xkcd-python.
```bash
pip install -U xkcd-python
```
## Usage
### Normal usage
```python
from xkcd_python import Client
#creates the client
client = Client()
# returns the comic by id
client.get(1)
# returns a random comic
client.random()
# returns the latest comic
client.latest_comic()
```
### Async usage
```python
from xkcd_python import Client
import asyncio
client = Client()
async def main():
tasks = (client.get(x) for x in range(1, 20))
return await asyncio.gather(*tasks)
asyncio.run(main)
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://github.com/Sas2k/xkcd-python/blob/main/LICENSE)