Skip to main content

A client library for accessing Sadales Tikls M2M API

Project description

sadales-tikls-m2m-api-client

A client library for accessing Sadales Tikls M2M API

OpenAPI

See preview in Swagger Editor online.

Keep in mind that direct queries from browser won't work due to known CORS issue.

Usage

First, create a client:

from sadales_tikls_m2m_api_client import AuthenticatedClient

client = AuthenticatedClient(base_url="https://services.e-st.lv/m2m", token="SuperSecretToken")

Now call your endpoint and use your models:

from sadales_tikls_m2m_api_client import AuthenticatedClient
from sadales_tikls_m2m_api_client.types import Response
from sadales_tikls_m2m_api_client.api.default import get_object_list
from sadales_tikls_m2m_api_client.models import GetObjectListResponse200

objects: GetObjectListResponse200 = get_object_list.sync(client=client)
# or if you need more info (e.g. status_code)
response: Response[GetObjectListResponse200] = get_object_list.sync_detailed(client=client)

Or do the same thing with an async version:

from sadales_tikls_m2m_api_client import AuthenticatedClient
from sadales_tikls_m2m_api_client.types import Response
from sadales_tikls_m2m_api_client.api.default import get_object_list
from sadales_tikls_m2m_api_client.models import GetObjectListResponse200

my_data: GetObjectListResponse200 = await get_object_list.asyncio(client=client)
response: Response[GetObjectListResponse200] = await get_object_list.asyncio_detailed(client=client)

Things to know:

  1. Every path/method combo becomes a Python module with four functions:

    1. sync: Blocking request that returns parsed data (if successful) or None
    2. sync_detailed: Blocking request that always returns a Request, optionally with parsed set if the request was successful.
    3. asyncio: Like sync but the async instead of blocking
    4. asyncio_detailed: Like sync_detailed by async instead of blocking
  2. All path/query params, and bodies become method arguments.

  3. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)

  4. Any endpoint which did not have a tag will be in sadales_tikls_m2m_api_client.api.default

Building / publishing this Client

This project uses Poetry to manage dependencies and packaging. Here are the basics:

  1. Update the metadata in pyproject.toml (e.g. authors, version)
  2. If you're using a private repository, configure it with Poetry
    1. poetry config repositories.<your-repository-name> <url-to-your-repository>
    2. poetry config http-basic.<your-repository-name> <username> <password>
  3. Publish the client with poetry publish --build -r <your-repository-name> or, if for public PyPI, just poetry publish --build

If you want to install this client into another project without publishing it (e.g. for development) then:

  1. If that project is using Poetry, you can simply do poetry add <path-to-this-client> from that project
  2. If that project is not using Poetry:
    1. Build a wheel with poetry build -f wheel
    2. Install that wheel from the other project pip install <path-to-wheel>

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

sadales-tikls-m2m-1.0.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

sadales_tikls_m2m-1.0.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file sadales-tikls-m2m-1.0.0.tar.gz.

File metadata

  • Download URL: sadales-tikls-m2m-1.0.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.5 Linux/4.4.0-19041-Microsoft

File hashes

Hashes for sadales-tikls-m2m-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ab6efd5bf29329b84e72cfa6eef104db4ca418e4b8b14ca0d952845381012180
MD5 ece3d4c14afaafe0c504b492e48525cb
BLAKE2b-256 e596856bc2bf8c37725d64f0e42a1f676315919c9dbbed116a9d6120903be8f4

See more details on using hashes here.

File details

Details for the file sadales_tikls_m2m-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sadales_tikls_m2m-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.5 Linux/4.4.0-19041-Microsoft

File hashes

Hashes for sadales_tikls_m2m-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 286cdd0e86c25238afa2b8f9c29032607a6ed8327af348cb2a83a6052ca5c6f6
MD5 e8dc2523d0b2b1bb4dc0156011623e37
BLAKE2b-256 e0b7694f8aab485d8f5d69fa4fb63de15f55c3a0636d0585154fd7e68315da79

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