Metadata-Version: 2.4
Name: tamamo
Version: 0.1.0
Summary: HTTP client that sends requests like real browsers and apps: TLS, HTTP/2, HTTP/3/QUIC fingerprints and headers, with sync and asyncio APIs
License-Expression: MIT
Project-URL: Homepage, https://github.com/yokai7482/tamamo
Project-URL: Documentation, https://github.com/yokai7482/tamamo/blob/main/docs/index.md
Project-URL: Changelog, https://github.com/yokai7482/tamamo/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/yokai7482/tamamo/issues
Project-URL: Source, https://github.com/yokai7482/tamamo
Keywords: http,http2,http3,quic,tls,ja3,ja4,fingerprint,browser,impersonate,asyncio,requests,tls-client
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Go
Classifier: Framework :: AsyncIO
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: UPSTREAM-LICENSE
License-File: THIRD_PARTY_NOTICES.md
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Requires-Dist: pytest-asyncio>=0.24; extra == "test"
Requires-Dist: aioquic>=1.2; extra == "test"
Dynamic: license-file

# tamamo

[![PyPI](https://img.shields.io/pypi/v/tamamo)](https://pypi.org/project/tamamo/) [![Python](https://img.shields.io/pypi/pyversions/tamamo)](https://pypi.org/project/tamamo/) [![test](https://github.com/yokai7482/tamamo/actions/workflows/test.yml/badge.svg)](https://github.com/yokai7482/tamamo/actions/workflows/test.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/yokai7482/tamamo/blob/main/LICENSE)

tamamo is an HTTP client for Python that passes for a real browser, right down to the TLS handshake. And probably the cutest one, too.

Many servers and CDNs identify a client by how it connects, not only by its `User-Agent` header. tamamo sends the same TLS ClientHello, HTTP/2 and HTTP/3 settings, and headers as the browser or app you choose, so your requests look like that client on the wire. You get a familiar `get` and `post` API with sync and asyncio sessions.

## Features

* 93 browser and app profiles: Chrome, Edge, Brave, Opera, Firefox, Safari on macOS, iOS, and iPadOS, Tor Browser, Android apps built on okhttp, the Zalando, Nike, Mesh, MMS, and Confirmed mobile apps, and the cloudscraper Python library. Each profile sets the TLS ClientHello, the HTTP/2 settings, and the default headers for its browser and operating system.
* HTTP/3 over QUIC for 53 profiles, with fingerprints captured from real browsers: QUIC ClientHello, transport parameters, packet layout, HTTP/3 SETTINGS, priorities, and QPACK streams.
* HTTP/1.1, HTTP/2, HTTP/3, and h2c, with strict version selection: when you ask for HTTP/2, tamamo never silently falls back to HTTP/1.1.
* Sync and asyncio sessions. Cancelling an asyncio task cancels the request on the wire, and Ctrl+C interrupts a sync request.
* Typed errors, automatic retries, streaming downloads, and separate timeouts for connecting, reading, writing, and the whole request.
* An RFC 6265 cookie jar with the public suffix list, plus import and export in browser-extension JSON and Netscape `cookies.txt` formats.
* HTTP, HTTPS, SOCKS4, SOCKS4a, SOCKS5, and SOCKS5h proxies, including HTTP/3 through SOCKS5.
* Custom TLS fingerprints from a JA3 string, and low-level TLS, HTTP/2, and ECH options.
* Built-in fingerprint checks: every response reports the JA3, JA4, and Akamai fingerprints of what tamamo sent.
* Prebuilt wheels with no Python dependencies.

## Installation

Install tamamo from PyPI:

```shell
python -m pip install tamamo
```

tamamo needs Python 3.11 or later. Prebuilt wheels are available for Windows x64, Linux x86-64 and aarch64 (glibc 2.17 or later), and macOS 11 or later (universal2). For other platforms and for building from source, see [Installing tamamo](https://github.com/yokai7482/tamamo/blob/main/docs/installation.md).

## Usage

A one-shot call impersonates the latest Chrome by default:

```python
import tamamo

r = tamamo.get("https://httpbin.org/get", params={"q": "tamamo"})
print(r.status_code, r.http_version)
# 200 2
```

For several requests, use a session. It keeps connections, cookies, and headers, and you choose the client to impersonate when you create it:

```python
from tamamo import Session

with Session(client_identifier="firefox_148", timeout=20) as s:
    r = s.post("https://httpbin.org/post", json={"name": "tamamo"})
    r.raise_for_status()
    print(r.json()["json"])
    # {'name': 'tamamo'}
```

`AsyncSession` has the same parameters and methods for asyncio:

```python
import asyncio

from tamamo import AsyncSession


async def main():
    async with AsyncSession(client_identifier="safari_ios_18_5") as s:
        urls = [f"https://httpbin.org/get?page={i}" for i in range(5)]
        pages = await asyncio.gather(*(s.get(url) for url in urls))
        print([r.status_code for r in pages])
        # [200, 200, 200, 200, 200]


asyncio.run(main())
```

For a guided tour of sessions, profiles, headers, and request bodies, see [Quickstart for tamamo](https://github.com/yokai7482/tamamo/blob/main/docs/quickstart.md).

## How it works

The Python package is a thin layer that holds sessions, headers, and the cookie jar, validates options, and raises typed errors. It calls a native Go library through `ctypes`. The Go side is built on [tls-client](https://github.com/bogdanfinn/tls-client), a [uTLS fork](https://github.com/bogdanfinn/utls), and [quic-go](https://github.com/quic-go/quic-go). It builds the handshakes, keeps connection pools, follows redirects with per-hop cookies, and measures the fingerprint of what it sent. tamamo doesn't reproduce the TCP/IP stack of another operating system, run JavaScript, or behave like a browser beyond the network requests. For more information, see [About tamamo](https://github.com/yokai7482/tamamo/blob/main/docs/about-tamamo.md) and [Known limitations](https://github.com/yokai7482/tamamo/blob/main/docs/limitations.md).

## Documentation

* [tamamo documentation](https://github.com/yokai7482/tamamo/blob/main/docs/index.md): guides, topic pages, and reference.
* [Examples](https://github.com/yokai7482/tamamo/blob/main/examples/README.md): runnable scripts that run in CI against a local server.
* [Changelog](https://github.com/yokai7482/tamamo/blob/main/CHANGELOG.md): changes in each release.

The API has docstrings and type hints, and the package ships a `py.typed` marker for type checkers.

## Get help

* To ask a question or report a bug, open an issue in [GitHub Issues](https://github.com/yokai7482/tamamo/issues).
* To report a security vulnerability, follow the [Security policy](https://github.com/yokai7482/tamamo/blob/main/SECURITY.md) and report it privately.

## Contributing

Bug reports, fingerprint captures from real browsers, and pull requests are welcome. For more information, see [Contributing to tamamo](https://github.com/yokai7482/tamamo/blob/main/CONTRIBUTING.md). Everyone who takes part in the project follows the [Contributor Covenant Code of Conduct](https://github.com/yokai7482/tamamo/blob/main/CODE_OF_CONDUCT.md).

## License

tamamo is released under the [MIT License](https://github.com/yokai7482/tamamo/blob/main/LICENSE). The native library includes code from tls-client (BSD-style license, see [UPSTREAM-LICENSE](https://github.com/yokai7482/tamamo/blob/main/UPSTREAM-LICENSE)), Go `net/http` and uTLS (BSD 3-clause), and quic-go and qpack (MIT). For details, see [Third-party notices](https://github.com/yokai7482/tamamo/blob/main/THIRD_PARTY_NOTICES.md).

This product includes software developed by Bogdan Finn.

Use tamamo for testing, research, and interoperability, and follow the terms of the services you send requests to.
