Skip to main content

A Python client for the Weclapp API.

Project description

weclappy

The weclapp Python Client.

There is no lightweight, simple weclapp client library available for Python currently. Let's build it together.

Overview

The goal of this library is to provide a minimal, threaded client that handles pagination effectively when fetching lists from the weclapp API. It is capable of retrieving large volumes of data by parallelizing page requests, significantly reducing wait times. This library is designed to be lean with no unnecessary bloat, allowing you to get started very quickly.

Features

  • Threaded Pagination: Fetch multiple pages concurrently for enhanced performance.
  • Minimal Dependencies: Only dependency is requests.
  • Simplicity: A lean bloat free solution to interact with the weclapp API.
  • Open Source: Free to use in any project, with contributions and improvements highly welcome.

Installation

Install the package via pip:

pip install weclappy

Quick Start

from weclappy import Weclapp

# Initialize the client with your base URL and API key
client = Weclapp("https://acme.weclapp.com/webapp/api/v1", "your_api_key")

# Fetch a single entity by ID, e.g., 'salesOrder' with ID '12345'
sales_order = client.get("salesOrder", id="12345")

# Fetch paginated results for an entity, e.g., 'salesOrder' with a filter
sales_orders = client.get_all("salesOrder", { "salesOrderPaymentType-eq": "ADVANCE_PAYMENT" }, threaded=True)

# Create a new entity, e.g., 'salesOrder'
new_sales_order = client.post("salesOrder", { "customerId": "12345", "commission": "Hello, world!" })

# Update an existing entity, e.g., 'salesOrder' with ID '12345', ignoreMissingProperties is True per default
updated_sales_order = client.put("salesOrder", id="12345", data={ "commission": "Hello, universe!" })

# Delete an entity, e.g., 'salesOrder' with ID '12345'
client.delete("salesOrder", id="12345")

# Get an invoice PDF
pdf_response = client.call_method("salesInvoice", "downloadLatestSalesInvoicePdf", sales_invoice["id"], method="GET")
# { "content": b"...", "content-type": "application/pdf" }

if "content" in pdf_response:
    pdf_bytes = pdf_response["content"]
    filename = "Rechnung.pdf"

    # Save the PDF to disk
    with open(filename, "wb") as f:
        f.write(pdf_bytes)
else:
    # Otherwise, it's likely an error
    print("Response:", pdf_response)

Examples

You can find useful examples in the examples folder. Make sure to create a virtual environment and install the dependencies first and prepare your environment file that holds your weclapp url and api key.

cd examples
python3 -m venv venv

# On a Unix-based system
source venv/bin/activate

# On a Windows system
venv\Scripts\activate

pip install -r requirements.txt

# Copy the .env.example file to .env and fill in your weclapp url and api key

# Run the example of your choice, in this case, fetch all sales invoices from weclapp.
python get_all_sales_invoices.py

Contributing

Contributions are very welcome. Any improvements, bug fixes, or new features are gladly accepted. Let’s build this client together to make working with the weclapp API as efficient as possible.

License

This project is licensed under the MIT License. Feel free to use it in your commercial projects with no restrictions.

Get in touch

If you are interested in working with us or want us to implement your integrations, then book a call. You can always book a call with me at https://wals.pro/termin.

Support

Feel free to use this library in all your projects for free. If you have a lot of fun and build something great with it, consider buying me a coffee.

Follow me on:

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

weclappy-0.1.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

weclappy-0.1.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file weclappy-0.1.2.tar.gz.

File metadata

  • Download URL: weclappy-0.1.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for weclappy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d1e63d42fbd0102865c301c24f10a5dac194227262eb51da7a5c1e3e66bbcf0f
MD5 0b4436fe1e1ce3a6dad613ead112671a
BLAKE2b-256 b9d215eb08d89e59b2136a6d5edbc2ab7218a9c0efbf211e788afe18814e1d13

See more details on using hashes here.

File details

Details for the file weclappy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: weclappy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for weclappy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11bb3890fca8a11abc8d92b8a4996c4364816715c49f2ecfd14804e0262ced09
MD5 bdfb880db6d4acde6e420ce904753d6e
BLAKE2b-256 bc0777b1077783c8875299045acb5c3e38c66ae6c11f7d84f84461735de3a7b9

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