Skip to main content

API wrapper for Siigo written in Python

Project description

siigo-python

siigo-python is an API wrapper for Siigo (accounting software), written in Python

Installing

pip install siigo-python

Usage

  • If you don't have an access token:
from siigo.client import Client
client = Client(email, access_key)
  1. Generate access token
response = client.generate_token()
  1. Set token
client.set_token(access_token)
  • If you already have an access token:
from siigo.client import Client
client = Client(token=access_token)

Users

- List users

# page_size limit = 100
users = client.list_users(page_size=25, page=1)

Products

- List products

# filter options: code, created_start, created_end, updated_start, updated_end, id, page_size, page
# date formats: 'yyyy-MM-dd' or 'yyyy-MM-ddTHH:mm:ssZ'
# id: It is possible to filter multiple ids at the same time separated by commas.
# page_size limit = 100
products = client.list_products(created_start="2023-01-01")

- Create product

product = client.create_product("AAAAA111233", "PS6", 1254, "Product")
# code: must be a unique value
# account_group: account group id, get list from: list_account_groups()
# type: options are 'Product', 'Service' or 'ConsumerGood'
# tax_classification: options are 'Taxed', 'Exempt' or 'Excluded'
# taxes: list of dictionaries with the following structure:
#   [{"id": "1234"}]
# prices: list of dictionaries with the following structure:
#   [{"currency_code": "COP", "price_list": [{"position": 1,"value": 12000}]}]
# unit: check siigo measure unit codes: https://siigoapi.docs.apiary.io/#reference/productos/crear-producto/crear-producto
# additional_fields: current options are: barcode, brand, tariff and model. Example:
#   {"barcode": "B0123", "brand": "Gef", "tariff": "151612", "model": "Loiry"}

Customers

- List customers

# filter options: identification, branch_office, created_start, created_end, updated_start, updated_end, page_size, page
# date formats: 'yyyy-MM-dd' or 'yyyy-MM-ddTHH:mm:ssZ'
# page_size limit = 100
customers = client.list_customers(created_start="2023-01-01")

- Create customer

customer = client.create_customer(
    "Person", 
    "13", 
    ["Juan Carlos", "Rios"], 
    [{"first_name": "Juan", "last_name": "Rios", "email": "juan.rios@contact.com",}],
    [{"indicative": "57", "number": "3006113345", "extension": "132"}],
    {
        "address": "Calle 47 Bis A 28-55",
        "city": {"country_code": "co", "state_code": "19", "city_code": "19001"},
        "postal_code": "110911",
    },
    "1019300200",
)
# person_type: options are "Person" or "Company"
# id_type: check siigo id types: https://siigoapi.docs.apiary.io/#reference/clientes/crear-cliente/crear-cliente
# name: if person type is "Company" list with just one value, if person type is "Person" list with two values
# contacts: list of dictionaries with the following structure:
#   [
#     {
#     "first_name": "Marcos",
#     "last_name": "Castillo",
#     "email": "marcos.castillo@contacto.com", 
#     "phone": {"indicative": "57", "number": "3006003345", "extension": "132"}
#     }
#   ]
# phones: list of dictionaries with the following structure:
#   [{"indicative": "57", "number": "3006003345", "extension": "132"}]
# address: object with the following structure:
#   {
#     "address": "Cra. 18 #79A - 42",
#     "city": {"country_code": "Co", "state_code": "19", "city_code": "19001"},
#     "postal_code": "110911"
#   }
# type: options are "Customer", "Supplier" or "Other"
# fiscal_responsibilities: options are "R-99-PN", "O-13", "O-15", "O-23" or "O-47"
# related_users: dictionary with two values "seller_id" and "collector_id"
#   Example: {"seller_id": 629, "collector_id": 629}

Invoices

- List invoices

# filter options: identification, branch_office, created_start, created_end, updated_start, updated_end, page_size, page
# date formats: 'yyyy-MM-dd' or 'yyyy-MM-ddTHH:mm:ssZ'
# page_size limit = 100
invoices = client.list_invoices(created_start="2023-01-01")

Create Invoice

fv = client.create_invoice(
    {"id": 24446},
    "2023-02-02",
    {"identification": "1040570645", "branch_office": 0},
    1018,
    [{ "code": "DEX6360", "description": "Shirt", "quantity": 1, "price": 8000.00, "discount": 0}],
    [{"id": 9485, "value": 8000.00, "due_date": "2023-01-01"}] 
)
# document: document type id. Dict with the following structure: {"id": 24446} \n
# date: yyyy-MM-dd format \n
# customer: customer identification and branch_office - {"identification": "13832081", "branch_office": 0} \n
# seller: seller id \n
# items: list of items with the following structure: \n
# [
#     {
#         "code": "Item-1", # must be a valid code.
#         "description": "Camiseta de algodón",
#         "quantity": 1,
#         "price": 1069.77,
#         "discount": 0,
#         "taxes": [{"id": 13156}]
#     }
# ] \n
# payments: list with the following structure: [{"id": 5636, "value": 1273.03, "due_date": "2021-03-19"}] \n
# currency: only for foreign exchange currency: {"code": "USD", "exchange_rate": 3825.03} \n
# Note: The total payments must be equal to the total invoice.

Catalogues

- List group accounts

groups = client.list_group_accounts()

- List taxes

taxes = client.list_taxes()

- List price lists

price_lists = client.list_price_lists()

- List cost centers

cost_centers = client.list_cost_centers()

- List document types

# options are "FV", "NC" or "RC"
doc_types = client.list_document_types("FV")

- List payment types

# options are "FV", "NC" or "RC"
payments = client.list_payment_types("FV")

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

siigo_python-0.1.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

siigo_python-0.1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file siigo_python-0.1.1.tar.gz.

File metadata

  • Download URL: siigo_python-0.1.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for siigo_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a13118b5ebec295378a8f1e78ab75b5feab266665038802a174bc07aaae839cd
MD5 a5a893d77d0edbecdd29485283dbebf4
BLAKE2b-256 c179a4719eb8ce4fba04ff0d68da748075cff567487868fcdabc682eaa73a0e0

See more details on using hashes here.

File details

Details for the file siigo_python-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for siigo_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e754c958003560f9342dbb1db1e75f5a33141579b9c611cf71d8021157d670f6
MD5 94ac3e2d1c240f1992dde80d386fafad
BLAKE2b-256 761d9261cf8cfd927b46eea0bb02c473c5f8f1d202e3567bbe4971aedfd58245

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page