Getting Started

Everything you need to start making HTTP requests with AtomHTTP

Why AtomHTTP?

AtomHTTP is a modern asynchronous HTTP client for Python that combines the best features from popular libraries while adding unique capabilities like progress tracking, interceptors, and full type hints.

AtomHTTP is a modern, feature-rich asynchronous HTTP client designed for Python developers who need reliability, flexibility, and performance.

With comprehensive built-in features including interceptors, progress tracking, multiple response types (JSON, text, blob, arraybuffer, stream), FormData support, concurrent request helpers, and thorough error handling with standardized error codes — AtomHTTP provides everything you need for production-grade HTTP communication.

Installation

Install AtomHTTP using pip. The library has minimal dependencies and works with Python 3.8 and above.

Basic installation:Minimal setup for production use

1
pip install atomhttp

With development dependencies:Includes pytest, black, mypy, ruff for development

1
pip install atomhttp[dev]

With testing dependencies only:Only testing tools without linters

1
pip install atomhttp[test]

Requires Python 3.8 or higher

Core dependency: aiohttp 3.8.0+ (automatically installed)

Quick Start

Create a client instance and start making requests in just a few lines of code.

Basic GET request:Simple request to fetch a single resource with automatic cleanup

1
2
3
4
5
6
7
8
9
10
11
import asyncio
from atomhttp import AtomHTTP

async def main():
    async with AtomHTTP() as client:
        response = await client.get('https://jsonplaceholder.typicode.com/posts/1')
        print(f"Status: {response.status}")
        print(f"Title: {response.data['title']}")
        print(f"User ID: {response.data['userId']}")

asyncio.run(main())

With configuration:Using baseURL, timeout, and default headers

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import asyncio
from atomhttp import AtomHTTP

async def main():
    client = AtomHTTP({
        'baseURL': 'https://jsonplaceholder.typicode.com',
        'timeout': 10,
        'headers': {'Accept': 'application/json'}
    })
    
    response = await client.get('/posts', params={'_limit': 5})
    
    for post in response.data:
        print(f"Post {post['id']}: {post['title'][:50]}...")
    
    await client.close()

asyncio.run(main())

POST request with JSON:Creating a new resource

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import asyncio
from atomhttp import AtomHTTP

async def main():
    client = AtomHTTP({'baseURL': 'https://jsonplaceholder.typicode.com'})
    
    new_post = await client.post('/posts', data={
        'title': 'My Awesome Post',
        'body': 'This is the content of my post',
        'userId': 1
    })
    
    print(f"Created with ID: {new_post.data['id']}")
    print(f"Status: {new_post.status}")
    
    await client.close()

asyncio.run(main())

System Requirements

AtomHTTP works on all major operating systems and has minimal requirements.

Python Version

  • 3.8
  • 3.9
  • 3.10
  • 3.11
  • 3.12
  • 3.13

Operating Systems

  • Windows 10/11
  • macOS (Intel + Apple Silicon)
  • Linux (Ubuntu, Debian, CentOS, etc.)
  • WSL (Windows Subsystem for Linux)

Your First Request

Let's make a complete example that demonstrates the most common features.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import asyncio
from atomhttp import AtomHTTP

async def main():
    # 1. Create client with configuration
    client = AtomHTTP({
        'baseURL': 'https://jsonplaceholder.typicode.com',
        'timeout': 10,
        'headers': {
            'Accept': 'application/json',
            'User-Agent': 'AtomHTTP-Demo/1.0'
        }
    })
    
    # 2. GET request with query parameters
    print("Fetching posts...")
    response = await client.get('/posts', params={'_limit': 3})
    
    print(f"Status: {response.status}")
    print(f"Headers: {dict(list(response.headers.items())[:3])}")
    
    for post in response.data:
        print(f"  Post {post['id']}: {post['title'][:40]}...")
    
    # 3. POST request
    print("\nCreating a new post...")
    new_post = await client.post('/posts', data={
        'title': 'Hello AtomHTTP!',
        'body': 'This is my first request with AtomHTTP',
        'userId': 1
    })
    
    print(f"Created with ID: {new_post.data['id']}")
    print(f"Response status: {new_post.status}")
    
    # 4. Clean up
    await client.close()
    print("\nDone!")

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

Next Steps

Now that you've mastered the basics, explore more advanced features.