Skip to main content

A python wrapper for xkcd.com

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xkcd_python-3.3.0.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file xkcd_python-3.3.0.tar.gz.

File metadata

  • Download URL: xkcd_python-3.3.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for xkcd_python-3.3.0.tar.gz
Algorithm Hash digest
SHA256 90ef175f9d670ca0f082bb7c9755781fed0344b588a0d4d5d1b9d7825b628bcb
MD5 7d1df640cea76a6a2361f3736ec0bbbf
BLAKE2b-256 e0962b9588c94b175c0d48868d7e980a04b520aba3e83893e302f797c3fda6cf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page