Skip to main content

Python library and CLI tool to scrape public user statistics from Printables.com

Project description

Printables Stats Scraper

A Python library and CLI tool to scrape public user statistics from Printables.com, including detailed badge levels.

Features

  • Public Stats: Fetches downloads, likes, followers, following, joined date, and model count.
  • Detailed Badges: Parses badges into a dictionary of {Name: Level} (e.g., {'Designer': 1, 'Maker': 4}).

Installation

From PyPI

pip install printables-stats

From Source

This project uses uv for dependency management.

# Clone the repository
git clone https://gitlab.com/yourusername/printables-stats.git
cd printables-stats

# Install dependencies
uv sync

Usage

CLI

You can use the included script to fetch stats for a specific user via environment variable.

export PRINTABLES_USER_ID='@josefprusa'
uv run python -m printables_stats

Output Example:

{
  "downloads": 4,
  "likes": 1,
  "followers": 0,
  "following": 4,
  "joined_date": "November 6, 2025",
  "models_count": 4,
  "badges": {
    "Designer": 1,
    "Maker": 4,
    "Download Maniac": 3,
    "Printables Maniac": 1
  }
}

Library

from printables_stats import PrintablesClient

client = PrintablesClient()
stats = client.get_user_stats('@josefprusa')

if stats:
    print(f"Downloads: {stats.get('downloads')}")
    print(f"Badges: {stats.get('badges')}")

Development

Run quality checks and tests:

uv run ruff check .

uv run ruff format .

uv run ty check .

uv run pytest

Releasing to PyPI

This project uses GitLab CI with PyPI Trusted Publisher (OIDC) for secure, token-less automated releases.

Prerequisites

Configure the Trusted Publisher on PyPI (one-time setup):

  1. Go to https://pypi.org/manage/account/publishing/
  2. Add a new Trusted Publisher with these details:
    • PyPI Project Name: printables-stats
    • Publisher: GitLab
    • Owner: Your GitLab username or group
    • Repository name: printables-stats
    • Workflow filename: .gitlab-ci.yml
    • Environment name: Leave empty (or specify if using environments)

No API tokens needed! GitLab authenticates via OIDC.

Release Process

  1. Update the version in pyproject.toml
  2. Commit and push your changes
  3. Create and push a git tag:
    git tag v0.1.0
    git push origin v0.1.0
    
  4. In GitLab, navigate to CI/CD → Pipelines
  5. Manually trigger the release job to publish to PyPI
  6. Verify the package on https://pypi.org/project/printables-stats/

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

printables_stats-0.1.0.tar.gz (22.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

printables_stats-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file printables_stats-0.1.0.tar.gz.

File metadata

  • Download URL: printables_stats-0.1.0.tar.gz
  • Upload date:
  • Size: 22.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for printables_stats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4d0fc44381fd28aa8e94f15d41c316a73eaad3959fea7f37adae9c626c788cc3
MD5 93dbe858b0692ab9cc3499f0c23bd181
BLAKE2b-256 84c0965df43069cd2523f0caf2bfb604465b723cab6ae6600cd54e0049dc9307

See more details on using hashes here.

File details

Details for the file printables_stats-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for printables_stats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c78824be183e79a6f6700746ecd95bbfcce8e9e48b1cb129ca1397179aba7a3f
MD5 be7db2dc98214d67aac5b245e595ff77
BLAKE2b-256 ea22ed49264f04a2f4880040fb5f6decbc538116cc7c75a94a1b716187a27818

See more details on using hashes here.

Supported by

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