Skip to main content

Collect POST requests easily

Project description

logo

succulent

Collect POST requests easily

PyPI Version PyPI - Python Version PyPI - Downloads AUR package Fedora package Downloads Packaging status GitHub license Build Documentation status

GitHub repo size GitHub commit activity Average time to resolve an issue Percentage of issues still open All Contributors

DOI

🔍 Detailed Insights📦 Installation🐳 Container🚀 Usage🔧 Configuration📄 Cite us🔑 License🫂 Contributors

Do you ever find it challenging and tricky to send sensor measurements 📏, data 📊, or GPS positions from embedded devices 📱, microcontrollers, and smartwatches to a central server? 📡 Setting up the primary data collection scripts can be a time-consuming ⏳ process, involving selecting a protocol, framework, API, and testing them out. Moreover, these scripts are often tailored for specific tasks, making them difficult to adapt to different scenarios.

But fear not! Introducing succulent 🌵, a pure Python framework that simplifies the configuration, management, collection, and preprocessing of data collected via POST requests. This framework draws inspiration from real-world data collection challenges in smart agriculture 🧠🌿, specifically plant monitoring using ESP32 devices. The main goal behind succulent is to streamline the process of configuring various data parameters and provide a range of useful functions for data transformations. By leveraging succulent, you can set up your entire data collection endpoint within minutes, freeing you from the hassle of dealing with server-side scripts. 🚀🔧

  • Free software: MIT license
  • Documentation: https://succulent.readthedocs.io/en/latest
  • Python versions: 3.8.x, 3.9.x, 3.10.x, 3.11.x, 3.12.x, 3.13.x
  • Tested OS: Windows, Ubuntu, Fedora, Alpine, Arch, macOS. However, that does not mean it does not work on others

🔍 Detailed Insights

The current version of succulent comes packed with exciting features, including, but not limited to:

  • Hassle-free generation of request URLs for seamless data collection 🌐
  • Effortless data retrieval from POST requests 📥
  • Versatile data storage options, such as CSV, JSON, SQLite, XML, and even images 🗂️📊🖼️
  • Customisable boundaries for collected data, allowing you to set minimum and maximum thresholds ⚙️

With succulent, the process of collecting, managing, and preprocessing data becomes a breeze, empowering you to focus on what truly matters—gaining valuable insights from your embedded devices, microcontrollers, and smartwatches. ⌚ So why waste precious time? ⏳ Dive into the world of succulent and unlock the true potential of your data! 💪📈

📦 Installation

pip

To install succulent with pip, use:

pip install succulent

Alpine Linux

To install succulent on Alpine Linux, use:

$ apk add py3-succulent

Arch Linux

To install succulent on Arch Linux, use an AUR helper:

$ yay -Syyu python-succulent

Fedora Linux

To install succulent on Fedora, use:

$ dnf install python3-succulent

🐳 Container

Create a docker-compose.yml file with the following content in the root directory:

version: '3.8'

services:
  app:
    image: codeberg.org/firefly-cpp/succulent:v6
    ports:
      - "8080:8080"
    volumes:
      - ./run.py:/succulent-app/run.py
      - ./configuration.yml:/succulent-app/configuration.yml
    environment:
      - GUNICORN_WORKERS=2

Next create a configuration.yml file in the root directory. Here's an example of a configuration file:

data:
  - name: 'temperature'
  - name: 'humidity'
  - name: 'light'
results:
  - enable: true
  - export: true
timestamp: true

More information regarding the configuration file and its settings can be found in the configuration section.

Then create a Python file named run.py with the following content in the root directory:

from succulent.api import SucculentAPI

api = SucculentAPI(config='configuration.yml', format='csv')

# Flask app instance, called by gunicorn
app = api.app

Once you have set up the configuration file and the Python file, build the Docker image with the following command:

docker compose build

Finally, run the Docker container with the following command:

docker compose up

🚀 Usage

Example

from succulent.api import SucculentAPI
api = SucculentAPI(host='0.0.0.0', port=8080, config='configuration.yml', format='csv')
api.start()

🔧 Configuration

Data collection

In the root directory, create a configuration.yml file and define the following:

data:
  - name: # Measure name
    min:  # Minimum value (optional)
    max:  # Maximum value (optional)

To collect images, create a configuration.yml file in the root directory and define the following:

data:
  - key: # Key in POST request

To store data collection timestamps, define the following setting in the configuration.yml file in the root directory:

timestamp: true # false by default

To access the URL for data collection, send a GET request (or navigate) to http://localhost:8080/measure.

To restrict access to the collected data, define the following setting in the configuration.yml file in the root directory:

password: 'password' # Password for data access

To store data using a password, append the password parameter to the request URL: ?password=password.

Data access

To access data via the Succulent API, define the following setting in the configuration.yml file in the root directory:

results:
  - enable: true # false by default

To access the collected data, send a GET request (or navigate) to http://localhost:8080/data. To access password-protected data, append the password parameter to the request URL: ?password=password.

Data export

To export the data, enable the export option in the configuration file:

results:
  - export: true # false by default

To export the data, send a GET request (or navigate) to http://localhost:8080/export. To export password-protected data, append the password parameter to the request URL: ?password=password. The data will be downloaded in the format specified in the configuration file.

📄 Cite us

Fister Jr., Iztok, and Tadej Lahovnik. Succulent. 0.4.0, doi:10.5281/zenodo.10402365.

🔑 License

This package is distributed under the MIT License. This license can be found online at http://www.opensource.org/licenses/MIT.

Disclaimer

This framework is provided as-is, and there are no guarantees that it fits your purposes or that it is bug-free. Use it at your own risk!

🫂 Contributors

Thanks goes to these wonderful people (emoji key):

Tadej Lahovnik
Tadej Lahovnik

💻 🐛 🤔 📖
Ayan Das
Ayan Das

💻 ⚠️
Iztok Fister Jr.
Iztok Fister Jr.

💻 🤔 🧑‍🏫
Oromion
Oromion

🐛 📦
rhododendrom
rhododendrom

🎨
Zala Lahovnik
Zala Lahovnik

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

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

succulent-0.4.3.tar.gz (121.5 kB view details)

Uploaded Source

Built Distribution

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

succulent-0.4.3-py3-none-any.whl (118.2 kB view details)

Uploaded Python 3

File details

Details for the file succulent-0.4.3.tar.gz.

File metadata

  • Download URL: succulent-0.4.3.tar.gz
  • Upload date:
  • Size: 121.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.9 Linux/6.17.7-200.fc42.x86_64

File hashes

Hashes for succulent-0.4.3.tar.gz
Algorithm Hash digest
SHA256 3430472aa9008f6ffedd1201ca5a5218be1dbd74c05b47c8c8643f9fbc1c97b3
MD5 4984b542f0caf1d8b2d4c96bd666ba6e
BLAKE2b-256 d024208c1e5fdb18b63abb08b27d63911c9fb84c18bf69a690038e2a2d9eacef

See more details on using hashes here.

File details

Details for the file succulent-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: succulent-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 118.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.9 Linux/6.17.7-200.fc42.x86_64

File hashes

Hashes for succulent-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 73b6910c7b8e4d8f475455d95f62e02b84ed05e02f7f89367f1bc76c574dd9d8
MD5 8fe2138922e2ee7d9c5d41a343f56e7a
BLAKE2b-256 7718b5dbcbe9bb6733370a822744ca57ff953a51988187788b344f20650a480f

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