Skip to main content

pyemoncms

python library for emoncms API

rely on aiohttp

to install : pip3 install pyemoncms

how to use :

import logging
import asyncio
from pyemoncms import EmoncmsClient

key = "your32bitsAPIkey"
url = "http://url:8081"
client = EmoncmsClient(url, key, request_timeout=1)
client.logger.setLevel("DEBUG")

async def get_path(path):
    print(await client.async_request(path))

async def list_feeds():
    print(await client.async_list_feeds())
    
async def get_feed_fields(feed_id):
    print(await client.async_get_feed_fields(feed_id))


loop = asyncio.get_event_loop()
loop.create_task(get_path("feed/list.json"))
loop.create_task(get_path("/user/getuuid.json"))
loop.create_task(list_feeds())
loop.create_task(get_feed_fields(1))
try:
    loop.run_forever()
except Exception:
    client.logger.error("something happened")
finally:
    loop.run_until_complete(client.close())
    loop.close()

even simpler with a context manager :

async def main():
    """fetches somes datas in emoncms"""
    async with EmoncmsClient(url, key, request_timeout=1) as client:
        client.logger.setLevel("DEBUG")
        print(await client.async_get_uuid())
        print(await client.async_list_feeds())
        print(await client.async_get_feed_fields(1))

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyemoncms-0.1.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

pyemoncms-0.1.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pyemoncms-0.1.3.tar.gz.

File metadata

  • Download URL: pyemoncms-0.1.3.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for pyemoncms-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4a2323cacce64de833897d2659d1ba5aba2b03077db89c843f5620dd838dfdd3
MD5 ced7ed35713589d40eb80fd1b36de794
BLAKE2b-256 a4a05e345c00b10d4b1958bab92ba64d9d61a2256d74a8316fc82bb15c44cab9

See more details on using hashes here.

File details

Details for the file pyemoncms-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pyemoncms-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for pyemoncms-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9631c77f5e6e2a3cd1a2c4a1d74aec306b2cf5c28b1d05a5368d96ea371d8ee1
MD5 aac9747e28b1cd8b82c8a0f4092b3409
BLAKE2b-256 c4b6a5b82739e0b31eec80751bd8bfd67e090452accc2260dc85472c4d7718f2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page