Skip to content

valentinc94/alegra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alegra API Client

This Python script serves as a client for the Alegra API (https://developer.alegra.com/). It allows you to list and interact with various resources provided by the API.

Installation

To install the Alegra API client and its dependencies, follow these steps:

  1. Clone the repository to your local machine:
   git clone https://github.com/valentinc94/alegra.git
  1. Change into the project directory:
   cd alegra
  1. Create a virtual environment (optional, but recommended):
   python -m venv venv
  1. Activate the virtual environment:
  • On Windows:
   venv\Scripts\activate
  • On macOS and Linux:
   source venv/bin/activate
  1. Install the required packages:
   pip install -r requirements/local.txt

Running the Tests

To run the unit tests, make sure you are in the project directory and the virtual environment is activated.

   python -m unittest discover tests

Usage

To use the Alegra API client in your own project, you can import the necessary classes from the client and utils modules.

Here's an example of how to list bank accounts using the client:

from alegra.client import Alegra

# Create an instance of the Alegra client
alegra = Alegra()

# List bank accounts
bank_accounts = alegra.bank_accounts.list().json()
print(bank_accounts)

Features!

If you want to interact with the taxes API endpoint from the Alegra documentation (), you can easily do so by using the Taxes class. This class provides the necessary methods to retrieve and list taxes, making them readily available for use in your application.

from alegra import api_resource

class Taxes(
    api_resource.Retrieve,
    api_resource.Listable,
    AlegraApiConfig,
):
    endpoint = "taxes"

Make sure to configure the environment variables ALEGRA_CLIENT_USERNAME, ALEGRA_CLIENT_TOKEN_AUTH, and ALEGRA_API_BASE_URL with your Alegra API credentials before running the client.

For more details on how to use the client and its methods, refer to the source code and the API documentation.

Contributing

If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.

Happy coding!

About

A Python library for Alegra's API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages