Skip to main content

PornPics Python Wrapper

PyPI version

An unofficial, developer-friendly Python wrapper for the PornPics website. It provides a clean, high-level interface for fetching galleries, categories, and search results, with both synchronous and asynchronous clients.

Features

  • Simple & Clean: A straightforward and easy-to-use API.
  • Sync & Async: Provides both Client (for synchronous code) and AsyncClient (for asyncio applications).
  • Type-Hinted: Fully type-hinted for a better developer experience with tools like MyPy and modern IDEs.
  • Data Models: Uses Pydantic models for robust and clear data representation.
  • No API Key Needed: Interacts with the website directly, so no API key is required.

Installation

Install the package from PyPI using pip:

pip install pornpics

Quick Start

Synchronous Client

Here's a simple example of how to use the synchronous Client:

from pornpics import Client

# Initialize the client
client = Client()

# 1. Get the homepage to discover categories and tags
print("--- Fetching Homepage ---")
homepage_items = client.get_home()
for item in homepage_items:
    print(f"Found {item.type}: {item.name} -> {item.link}")

# 2. Search for galleries
print("\n--- Searching for 'amateur' ---")
search_results = client.search("amateur")
if search_results.galleries:
    print(f"Found {search_results.total_galleries} galleries.")
    for gallery in search_results.galleries:
        print(f"- {gallery.title} ({len(gallery.images)} images)")

    # 3. Fetch a specific gallery from the search results
    first_gallery_slug = search_results.galleries[0].slug
    print(f"\n--- Fetching gallery: {first_gallery_slug} ---")
    gallery_details = client.get_gallery(first_gallery_slug)
    print(f"Title: {gallery_details.title}")
    print(f"Tags: {gallery_details.tags}")
    print(f"Image URLs: {[img.url for img in gallery_details.images]}")

# 4. Fetch a category page
print("\n--- Fetching category 'teen' ---")
category_page = client.get_category("teen") # 'teen' is the slug
print(f"Category has {category_page.total_galleries} galleries.")
for gallery in category_page.galleries:
    print(f"- {gallery.title}")

Asynchronous Client

The AsyncClient provides the same functionality but with async/await syntax.

import asyncio
from pornpics import AsyncClient

async def main():
    # Initialize the async client
    client = AsyncClient()

    # Search for galleries asynchronously
    print("--- Searching for 'ebony' (async) ---")
    search_results = await client.search("ebony")
    if search_results.galleries:
        print(f"Found {search_results.total_galleries} galleries.")

        # Fetch the first gallery
        first_gallery_slug = search_results.galleries[0].slug
        gallery_details = await client.get_gallery(first_gallery_slug)
        print(f"Fetched gallery: {gallery_details.title}")

if __name__ == "__main__":
    asyncio.run(main())

API Reference

Client and AsyncClient

Both clients provide the same methods. The only difference is that AsyncClient methods are coroutines and must be awaited.

  • get_home(): Fetches the homepage and returns a list of featured HomeMedia objects (tags and categories).
  • search(query, lang="en", offset=0, limit=0): Performs a search. Returns a SearchResponse object containing a list of Gallery previews.
  • get_gallery(slug): Fetches a single, detailed gallery by its URL slug. Returns a GalleryResponse object with full-resolution image URLs and metadata.
  • get_category(slug, offset=0, limit=20): Fetches a category or tag page by its slug. Returns a CategoryResponse object containing a paginated list of Gallery previews.

Data Models

The wrapper uses Pydantic models to structure the returned data. Key models include:

  • GalleryResponse: A full gallery with title, tags, and a list of Image objects.
  • CategoryResponse: A category page with total gallery count and a list of Gallery previews.
  • SearchResponse: Search results with total gallery count and a list of Gallery previews.
  • HomeMedia: An item from the homepage, representing a tag or category.
  • Gallery: A gallery preview, typically found in search or category listings.
  • Image: A single image with its URL and thumbnail URL.

Future Enhancements

Support for proxies, cookies, and custom headers is planned for a future release. The architecture is designed to easily accommodate these features by extending the Client and AsyncClient constructors.

Disclaimer

This is an unofficial wrapper and is not affiliated with, endorsed, or sponsored by PornPics. Please use it responsibly.

Metadata

Release files for pornpics 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pornpics 0.1.0
File Size Uploaded Provenance Actions
pornpics-0.1.0.tar.gz 11.8 kB Without provenance Details for pornpics-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pornpics 0.1.0
File Interpreter ABI Platform Actions
pornpics-0.1.0-py3-none-any.whl Python 3 none any Details for pornpics-0.1.0-py3-none-any.whl

Total release size: 20.7 kB

Release files / pornpics-0.1.0.tar.gz

Download URL pornpics-0.1.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
eba6cac9aba285373b8b4778df69737a4ae503db396eb03eb568c1e0151092e2
BLAKE2b-256 checksum
How to use checksums
8778cc1eccd0e2e4fc9823230432a37ffb210be35813351666f0b31e6078b742
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / pornpics-0.1.0-py3-none-any.whl

Download URL pornpics-0.1.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00eccd09ffedb9b138e8373dc18b61b36ecc3bc8b7be23bf0652ef8fdd1cf934
BLAKE2b-256 checksum
How to use checksums
03547d914cde060fb6777a3f048680cfe676d1b29e6271cf559b06fc5d91f721
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for pornpics 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page