Skip to content
/ primp Public

HTTP client that can impersonate web browsers

License

Notifications You must be signed in to change notification settings

deedy5/primp

Repository files navigation

Python >= 3.10 Downloads CI

🪞 PRIMP

Python Requests IMPersonate | The fastest Python HTTP client that can impersonate web browsers.

📦 Installation

pip install -U primp

🚀 Quick Start

Sync API

import primp

# Create client with browser impersonation
client = primp.Client(impersonate="chrome_145")

# Make requests
resp = client.get("https://httpbin.org/get")
print(resp.status_code)  # 200
print(resp.text)         # Response body
print(resp.json())       # Parsed JSON

Async API

import asyncio
import primp

async def main():
    async with primp.AsyncClient(impersonate="chrome_145") as client:
        resp = await client.get("https://httpbin.org/get")
        print(await resp.text)

asyncio.run(main())

📊 Benchmark

🎭 Browser Impersonation

Browser Profiles
🌐 Chrome chrome_144, chrome_145
🧭 Safari safari_18.5, safari_26
🔷 Edge edge_144, edge_145
🦊 Firefox firefox_140, firefox_146
Opera opera_126, opera_127
🎲 Random random

💻 OS Impersonation

OS Value
🤖 Android android
🍎 iOS ios
🐧 Linux linux
🍏 macOS macos
🪟 Windows windows
🎲 Random random

⚡ Features

  • 🔥 Fast - Built with Rust
  • 🎭 Browser Impersonation - Mimic Chrome, Safari, Firefox, Edge, Opera
  • 🌍 OS Impersonation - Windows, Linux, macOS, Android, iOS
  • 🔄 Sync & Async - Both APIs available
  • 🍪 Cookie Management - Persistent cookie store
  • 🌐 Proxy Support - HTTP, HTTPS, SOCKS5
  • 📝 HTML Conversion - Convert to markdown, plain text, rich text
  • 📤 File Uploads - Multipart/form-data support
  • 🔐 SSL Verification - Custom CA certificates

📖 Response Object

resp.status_code      # HTTP status code
resp.text             # Response body as text
resp.content          # Response body as bytes
resp.json()           # Parsed JSON
resp.headers          # Response headers
resp.cookies          # Response cookies
resp.url              # Final URL
resp.encoding         # Character encoding

# HTML conversion
resp.text_markdown    # HTML → Markdown
resp.text_plain       # HTML → Plain text
resp.text_rich        # HTML → Rich text

# Streaming
for chunk in resp.stream():
    print(chunk)

📚 More Examples

See the /examples folder for detailed usage:


Disclaimer

This tool is for educational purposes only. Use it at your own risk.