gocomics.py

Installation

Python 3.8 or higher is required.

To install the stable version, do the following:

# Unix / macOS
python3 -m pip install "gocomics.py"

# Windows
py -m pip install "gocomics.py"

To install the development version, do the following:

$ git clone https://github.com/Infiniticity/gocomics.py

Make sure you have the latest version of Python installed, or if you prefer, a Python version of 3.8 or greater.

If you have have any other issues feel free to search for duplicates and then create a new issue on GitHub with as much detail as possible. Include the output in your terminal, your OS details and Python version.

Comic

class gocomics.Comic(identifier: str, date: Optional[datetime] = None, *, random: bool = False)

A class that represents a comic.

Parameters
  • identifier (str) – The comic’s identifier.

  • date (Optional[datetime]) – The comic’s date.

  • random (Optional[bool]) – Whether to choose a random comic, or not.

Note

If random is True, date must not be specified.

Variables
  • accountable_person – The person accountable for the comic.

  • avatar – The url of the comic avatar.

  • banner – The comic’s banner.

  • calendar – A list containing comics released in that month.

  • code – The code associated with the comic.

  • creator – The creator of the comic.

  • date – The comic’s date

  • feature_banner – The comic’s banner which is featured in searches.

  • feature_id – The comic’s feature ID.

  • formatted_date – A formatted version of the comic’s date.

  • identifier – The comic’s identifier.

  • image – The URL of the comic’s image.

  • name – The name of the comic.

  • shareable_id – The comic’s shareable ID.

  • url – The comic’s URL.

Comic List

class gocomics.ComicList(code: int, infinity: Optional[int] = 20)

A class that represents a comic list.

Parameters
  • code (int) – The comic list’s code.

  • infinity (Optional[int]) – Represents a maximum for internal usage; the higher this value, the better the results.

Variables
  • code – The comic list’s code.

  • title – The comic list’s title.

  • author – The comic list’s author.

  • date – The comic list’s release date.

  • formatted_date – A formatted version of the comic list’s date.

  • identifier – The comic list’s identifier.

  • description – The comic list’s description.

  • url – The comic list’s URL.

  • comics – A list containing comics from the comic list.

Warning

comics is heavy on resources when called for the first time.

Other Functions

gocomics.fetch_comics(*, category: Optional[str] = None) List[str]

Fetches a list of comic URL slugs.

Parameters

category (str) – The comic category.

gocomics.search(text: str, *, category: Optional[Literal['comic', 'feature']] = 'comic', page: Optional[int] = 1, sort: Optional[Literal['relevance', 'ascending', 'descending']] = 'relevance') List[Comic]

Searches GoComics.

Parameters
  • text (str) – The text to search for.

  • category (Optional[Literal["comic", "feature"]]) – The category to search in.

  • page (Optional[int]) – The page number.

  • sort (Optional[Literal["ascending", "descending"]]) – The method of sorting results (based on date).