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.1.0.tar.gz (40.0 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.1.0-py3-none-any.whl (48.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fortytwo_client-2.1.0.tar.gz
Algorithm Hash digest
SHA256 cea47c94c1fa9f24f5eaca5bff07802f0f322b6833ae0daa2234d216998514e6
MD5 b12320c258630bf28c70b9d97705f7d7
BLAKE2b-256 7bf8beba886fc667beefa9224c0aa62cc7f69b1248400c336d6293e7702f733c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fortytwo_client-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89968cf3c3bdb8b0d5571a481a0f688816a12c5fba1ad58d16c6ab9da5b5ae76
MD5 25cea774d17792987a055139d4908d36
BLAKE2b-256 1bb73815aa179de58a27941a43d3a713ab17f57e13db0e154768d361ebe5ec51

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