Skip to main content

A Python client library for the 42 School API

Project description

42 Client

A Python client library for the 42 School API that simplifies authentication and data retrieval.

Features

  • Easy authentication with 42 API
  • Convenient methods for fetching users, projects, locations, and more
  • Built-in request handling and error management
  • Type hints support
  • Customizable request parameters

Installation

From PyPI (recommended)

# Using pip
pip install fortytwo-client

# Using uv (recommended)
uv add fortytwo-client

From source

git clone https://github.com/lucas-ht/fortytwo-client.git
cd fortytwo-client
uv sync

Development installation

git clone https://github.com/lucas-ht/fortytwo-client.git
cd fortytwo-client
uv sync --group dev

Quick Start

1. Get your API credentials

First, you need to create an application on the 42 API to get your client ID and secret.

2. Basic usage

from fortytwo import FortyTwoClient, FortyTwoConfig

# Configure the client
config = FortyTwoConfig(
    ...
)

# Create client instance
client = FortyTwoClient(config)

# Fetch user information
user = client.users.get_by_id(user_id=12345)
print(f"User: {user['login']}")

3. Advanced usage with custom parameters

from fortytwo import parameter

...

# Use custom parameters for filtering and pagination
user = client.users.get_all(
    # Use the filter by login parameter to fetch user by login
    parameter.UserParameters.Filter.by_login("example")
)

Authentication

The client handles OAuth2 authentication automatically. Simply provide your client credentials in the configuration.

Examples

See the example/ directory for more detailed usage examples:

Documentation

For detailed documentation on each resource type:

License

MIT License - see the LICENSE file for details.

Links

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

fortytwo_client-2.0.0.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

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

fortytwo_client-2.0.0-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file fortytwo_client-2.0.0.tar.gz.

File metadata

  • Download URL: fortytwo_client-2.0.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.22

File hashes

Hashes for fortytwo_client-2.0.0.tar.gz
Algorithm Hash digest
SHA256 91e04df0271591a9a4712b6123766aa58b3ecf17fa1157835dd412b408ab06d3
MD5 dd341e26ead37b868d8744ce36ddf8c4
BLAKE2b-256 89f882d8aec05ebfa214b52a0fe33181dcc1db23fa85dcbed8920179533e9fe9

See more details on using hashes here.

File details

Details for the file fortytwo_client-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fortytwo_client-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3dc407c42bcb90406b2b5686be2460f40b243d6061f2b7558d1d6e034f2a7b6f
MD5 b293e7ddc80e240ba75070018e5c5557
BLAKE2b-256 ed2c0577f47088c661109932a9e8209bafe7dcc98a65b4d3b1816c5948e47e01

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