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/Ombucha/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, release_date: datetime | date | None = None)¶
A class that represents a comic.
Note
The latest comic is shown if no date is provided. Random comics are not supported because a comic is not released every day.
Note
Update the values of RETRY_COUNT and BASE_DELAY if you encounter issues with fetching comic data.
- Parameters:
identifier (
str) – The comic’s identifier.date (Optional[
datetimeordate]) – The comic’s date.
- Variables:
url – The URL of the comic.
title – The title of the comic.
description – The description of the comic.
share_image_url – The URL of the comic’s share image.
keywords – The keywords associated with the comic.
author – The author of the comic.
followers_count – The number of followers of the comic.
name – The name of the comic.
header_feature_url – The URL of the comic’s header feature image.
image_url – The URL of the comic’s main image.
about – A list of hyperlinks and text describing the comic.
about_feature_url – The URL of the comic’s about feature image.
about_author – A list of hyperlinks and text describing the comic’s author.
author_image_url – The URL of the comic author’s image.
social_urls – A list of hyperlinks to the comic’s social media profiles.
characters – A list of characters in the comic.
- class Character(name: str, image_url: str, description: str)¶
A class that represents a character in a comic.
- Parameters:
name (
str) – The name of the character.image_url (
str) – The URL of the character’s image.description (
str) – A description of the character.
- class Hyperlink(url: str, text: str)¶
A class that represents a hyperlink.
- Parameters:
url (
str) – The URL of the hyperlink.text (
str) – The text of the hyperlink.
- download(*, filename: str | None = None, path: str | None = None) str¶
Downloads the comic image and returns the file path.
- Parameters:
filename (Optional[str]) – Optional filename for the downloaded image.
path (Optional[str]) – Optional path where the image will be saved.
- refresh() None¶
Refreshes the comic data by re-fetching it from the website. It can be useful if a particular attribute is not set or if you want to update the comic’s data without creating a new instance.
- show(*, filename: str | None = None, path: str | None = None) None¶
Opens the comic’s URL in the default image viewer app.
- Parameters:
filename (Optional[str]) – Optional filename for the downloaded image.
path (Optional[str]) – Optional path where the image will be saved.
Other Functions¶
- gocomics.search(*, last_updated_today: bool | None = None, categories: List[Literal['comicos-en-espanol', 'family-comics', 'funny-animals', 'gag-comics', 'graphic-novels', 'mental-health-comics', 'newspaper-comic-strips', 'offbeat-comics', 'office-humor', 'relationship-comics', 'sci-fi-fantasy-comics', 'sports-comics', 'vintage-comics', 'webcomics', 'kids']] | None = None) List[str]¶
Returns an alphabetical list of comic identifiers.
- Parameters:
last_updated_today (Optional[bool]) – If True, only return comics updated today.
categories (List[Literal["comicos-en-espanol", "family-comics", "funny-animals", "gag-comics", "graphic-novels", "mental-health-comics", "newspaper-comic-strips", "offbeat-comics", "office-humor", "relationship-comics", "sci-fi-fantasy-comics", "sports-comics", "vintage-comics", "webcomics", "kids"]]) – A list of categories to filter the comics.
- gocomics.search_political(*, last_updated_today: bool | None = None, categories: List[Literal['left', 'center', 'right']] | None = None) List[str]¶
Returns an alphabetical list of political comic identifiers.
- Parameters:
last_updated_today (Optional[bool]) – If True, only return comics updated today.
categories (List[Literal["left", "center", "right"]]) – A list of political categories to filter the comics.
- gocomics.get_popular_comics(*, political: bool | None = False) List[str]¶
Returns a list of popular comic identifiers.
- Parameters:
political (Optional[bool]) – If True, returns popular political comics.
- gocomics.stream_comics(identifier: str, *, start_date: datetime | None = datetime.datetime(1993, 7, 12, 0, 0), end_date: datetime | None = datetime.datetime(2025, 6, 22, 7, 14, 21, 314762)) Generator[Comic, None, None]¶
Streams comics for a given identifier from start_date to end_date.
- Parameters:
identifier (str) – The comic identifier.
start_date (Optional[datetime]) – The start date for the comic stream.
end_date (Optional[datetime]) – The end date for the comic stream.