Skip to main content

A Python module to interact with the IEMAP REST API

Project description

Project Logo

Iemap-MI Python Module

PyPI version License: MIT

Iemap-MI is a Python module that provides easy access to the IEMAP REST API. It includes functionality for user authentication, fetching paginated project data, and more. The module is designed to be used asynchronously and leverages httpx for making HTTP requests and pydantic for data validation.

Features

  • JWT Authentication: Authenticate users and manage sessions with JSON Web Tokens.
  • Project Data: Fetch paginated project data from the API.
  • Asynchronous Requests: Utilize httpx for efficient, asynchronous HTTP requests.
  • Data Validation: Ensure data integrity with pydantic models.

Installation

To install the module, use poetry:

poetry add iemap-mi

Alternatively, you can install it using pip:

pip install iemap-mi

Usage

Here are some examples of how to use the iemap-mi module.

Initialize the Client and Authenticate

import asyncio
from iemap_mi.iemap_mi import IemapMI


async def main():


# Initialize the client
client = IemapMI()

# Authenticate to get the JWT token
await client.authenticate(username='your_username', password='your_password')

# Fetch example data
data = await client.get_example_data()
print(data)

if __name__ == "__main__":
    asyncio.run(main())

Fetch Paginated Project Data

import asyncio
from iemap_mi.iemap_mi import IemapMI


async def main():


# Initialize the client
client = IemapMI()

# Authenticate to get the JWT token
await client.authenticate(username='your_username', password='your_password')

# Fetch paginated project data
projects = await client.project_handler.get_projects(page_size=10, page_number=1)
print(projects)

if __name__ == "__main__":
    asyncio.run(main())

Running Tests

To run the tests, use pytest. Make sure to set the TEST_USERNAME and TEST_PASSWORD environment variables with your test credentials.

export TEST_USERNAME="your_username"
export TEST_PASSWORD="your_password"
pytest

Using pytest with poetry

poetry run pytest

Contributing

Contributions are welcome! Please follow these steps to contribute:

Fork the repository.
Create a new branch for your feature or bugfix.
Make your changes.
Ensure tests pass.
Submit a pull request.

License

This project is licensed under the MIT License.
See the LICENSE file for more information.
Acknowledgements

httpx
pydantic

Contact

For any questions or inquiries, please contact iemap.support@enea.it.

This`README.md`
includes
an
overview
of
the
project, installation
instructions,
    usage
examples, testing
guidelines, contribution
guidelines, license
information,
    acknowledgements, and
contact
information.

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

iemap_mi-0.1.7.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

iemap_mi-0.1.7-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file iemap_mi-0.1.7.tar.gz.

File metadata

  • Download URL: iemap_mi-0.1.7.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.9.9-arch1-1

File hashes

Hashes for iemap_mi-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b7ad893274dbab0f944419f801b0e30091bab5d5d88c76da26416d1f7be1e774
MD5 08ddd8ab779556744a8de68b99dfae84
BLAKE2b-256 222a8f8617af8ab986772cb8c553b12551c9dfca1fac06a1d46790f57a242d80

See more details on using hashes here.

File details

Details for the file iemap_mi-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: iemap_mi-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.9.9-arch1-1

File hashes

Hashes for iemap_mi-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0e2e2b374dcf7d69bd926248d2912f5f367784b1956bdc4de9159e533d934c67
MD5 c87414334f4b7a88ef423029b1945bc0
BLAKE2b-256 288c398ced4ee9524061a9c37701f8e7fd6be3c424e3896173b84df697e13f66

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