Skip to main content

SwimRankings Python Library

A modern Python library for interacting with swimrankings.net, providing easy access to athlete data, search functionality, and more.

Features

  • 🏊‍♀️ Athlete Search: Search for athletes by name, gender, and other criteria
  • 📈 Detailed Data: Fetch personal bests, profile information, and more
  • 📊 Type Hints: Full type annotation support for better IDE experience
  • 🔍 Flexible Filtering: Filter athletes by gender, country, club, etc.
  • 🚀 Async Support: Coming soon!

Installation

pip install swimrankings

Cloudflare requirement

swimrankings.net is protected by Cloudflare's "Just a moment..." challenge. To get past it, this library solves the challenge once using a real local Chrome/Chromium browser (driven by nodriver), then reuses the resulting clearance for fast curl_cffi requests. The clearance is cached on disk (~/.cache/swimrankings/) and refreshed automatically when it expires. No third-party services, accounts, or API keys are involved.

Requirements:

  • Chrome or Chromium installed locally.

  • On a headless server (no display), install the system xvfb package — the challenge cannot be solved with headless Chrome, so a virtual display is used automatically via pyvirtualdisplay:

    sudo apt-get install -y xvfb chromium
    

The first request in a fresh environment is slower (it launches the browser); subsequent requests use the cached clearance and are fast.

Optional environment variables:

  • SWIMRANKINGS_BROWSER_PATH — path to a specific Chrome/Chromium binary.
  • SWIMRANKINGS_CACHE_DIR — override the clearance cache directory.

Quick Start

from swimrankings import Athletes

# Search for athletes by name
athletes = Athletes(name="Druwel")
for athlete in athletes:
    print(f"{athlete.full_name} ({athlete.birth_year}) - {athlete.country}")

# Get detailed information including personal bests
athlete = athletes[0]
details = athlete.get_details()

print(f"Personal bests: {len(details.personal_bests)}")
for pb in details.personal_bests:
    print(f"  {pb.event} ({pb.course}): {pb.time}")

Documentation

📖 Complete Documentation - Full API reference, examples, and guides

For detailed usage examples, API reference, error handling, and contributing guidelines, please visit the complete documentation.

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for swimrankings 0.2.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 swimrankings 0.2.0
File Size Uploaded Provenance
swimrankings-0.2.0.tar.gz 126.8 kB With provenance Details

Built distribution (wheel)

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

Total release size: 146.3 kB

Release files / swimrankings-0.2.0.tar.gz

Download URL swimrankings-0.2.0.tar.gz
Size 126.8 kB
Tags Source
SHA-256 checksum
How to use checksums
beb753056d5cdb1e473c6b27b66afd09cc3fb1b7e4e50aa3e561d2fe00cd801c
BLAKE2b-256 checksum
How to use checksums
db9fc4563788150af7b67901830d4afe7125688210992936e598a7d855ce80f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / swimrankings-0.2.0-py3-none-any.whl

Download URL swimrankings-0.2.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05080fdf554a7704cfb02fd153d9867b8d1b387971d79f2287e25a304417ac95
BLAKE2b-256 checksum
How to use checksums
bef0300ecc5fb4bd2aa99f912e900bc87a5215513f3fd5e613ad1fea69bd939c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for swimrankings 0.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for swimrankings-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

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.

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