Skip to main content

Small module to work with Userside ERP

Project description

Userside module for python

Install

You can install userside module via pip

 pip install pyuserside

Examples

Sync API


.. code:: python

    from pyuserside.api.synchronous import UsersideAPI

    usapi = UsersideAPI(url='https://localhost/api.php', key='my_secret_key')

    device_id = usapi.device.get_device_id(object_type='switch',
                                           data_typer='ip',
                                           data_value='10.90.90.90')
    devices = uapi.device.get_data(object_type='switch', object_id=device_id)
    target_device = devices[str(device_id)]

Or context manager:

.. code:: python

    from pyuserside.api.synchronous import UsersideAPI

    with UsersideAPI(url='https://localhost/api.php', key='my_secret_key') as uapi:
        device_id = usapi.device.get_device_id(object_type='switch',
                                               data_typer='ip',
                                               data_value='10.90.90.90')
        devices = uapi.device.get_data(object_type='switch', object_id=device_id)
        target_device = devices[str(device_id)]

Async API

Same here

.. code:: python

from pyuserside.api.asynchronous import UsersideAPI
import asyncio

async def main():
    usapi = UsersideAPI(url='https://localhost/api.php', key='my_secret_key')

    device_id = await usapi.device.get_device_id(object_type='switch',
                                                 data_typer='ip',
                                                 data_value='10.90.90.90')
    devices = await usapi.device.get_data(object_type='switch', object_id=device_id)
    target_device = devices[str(device_id)]

asyncio.run(main())

Or async context manager:

.. code:: python

from pyuserside.api.asynchronous import UsersideAPI
import asyncio

async def main():
    async with UsersideAPI(url='https://localhost/api.php', key='my_secret_key') as usapi:
        device_id = await usapi.device.get_device_id(object_type='switch',
                                                     data_typer='ip',
                                                     data_value='10.90.90.90')
        devices = await usapi.device.get_data(object_type='switch', object_id=device_id)
        target_device = devices[str(device_id)]

asyncio.run(main())

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

pyuserside-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

pyuserside-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pyuserside-0.1.0.tar.gz.

File metadata

  • Download URL: pyuserside-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pyuserside-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1bc2b095615a733ddaedb4972df30478ee4b663551305cb086af373f3b654059
MD5 10fa4196a4338bccb8d674137c099f26
BLAKE2b-256 fa8ac91ccf7408a93cfab24c042b1d24057829d8194e1776cc0778d7cdfdc718

See more details on using hashes here.

File details

Details for the file pyuserside-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyuserside-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pyuserside-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 112a9f21a1664672fc41d3821171a55ff262b50796a79cf1e70cbc06a4fcdb14
MD5 c9e77550806174616b5bc89d4202da70
BLAKE2b-256 f2523e0a1426b6409d80780cefcf797c26bd4d8c8bcf45e469f950aa573d8a67

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