Skip to content

Sas2k/xkcd-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xkcd-python

PYPI weekly Downloads PYPI monthly Downloads

xkcd-python is an API wrapper for xkcd.com written in python.

Installation

Use the package manager pip to install xkcd-python.

pip install -U xkcd-python

Usage

Normal usage

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

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