Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

alegra is a python package for connect to the Alegra's API.

Project description

A Python library for Alegra’s API.

Setup

You can install this package by using the pip tool and installing:

$ pip install alegra

Usage

The library needs to be configured with your user and token which is available in your Alegra Account: https://app.alegra.com/configuration/api

Set alegra.user and alegra.token to their values:

import alegra

alegra.user = "...@..."
alegra.token = "..."

# List contacts.
alegra.Contact.list()

# Create contact.
alegra.Contact.create(
  name="Chaty",
  identification={
    "type": "RUC", "number": "20000000000",
  },
  email="developer@okchaty.com",
  type=["client"],
  address={
    "address": "Jr. Neptuno 777",
    "city": "Lima, Peru",
  },
)

# Retrieve contact.
alegra.Contact.retrieve(123)

# Modify contact.
alegra.Contact.modify(
  resource_id=contact_id,
  identification={
    "type": "RUC",
    "number": "20000000001",
  },
)

# Delete contact.
alegra.Contact.delete(123)

Using the Alegra API

Documentation can be found here:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for alegra, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size alegra-0.1.1-py3-none-any.whl (9.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size alegra-0.1.1.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page