{"id":22643455,"url":"https://github.com/hf-kklein/osem-python-client","last_synced_at":"2025-10-29T16:19:44.319Z","repository":{"id":213258465,"uuid":"733041849","full_name":"hf-kklein/osem-python-client","owner":"hf-kklein","description":"async HTTP client for OpenSenseMap REST API with fully typed models","archived":false,"fork":false,"pushed_at":"2024-04-29T17:33:06.000Z","size":68,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-11T17:39:32.099Z","etag":null,"topics":["aiohttp-client","opensensemap-api","osem","pydantic-v2"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hf-kklein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-18T12:37:52.000Z","updated_at":"2023-12-19T11:09:09.000Z","dependencies_parsed_at":"2024-02-06T08:24:21.240Z","dependency_job_id":"b4bdb33d-5856-479a-8282-8751e7e05280","html_url":"https://github.com/hf-kklein/osem-python-client","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":"0.33333333333333337","last_synced_commit":"6ef5de76a265ef19281ffa58701ba7470d9f2a9a"},"previous_names":["hf-kklein/osem-python-client"],"tags_count":8,"template":false,"template_full_name":"Hochfrequenz/python_template_repository","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf-kklein%2Fosem-python-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf-kklein%2Fosem-python-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf-kklein%2Fosem-python-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf-kklein%2Fosem-python-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hf-kklein","download_url":"https://codeload.github.com/hf-kklein/osem-python-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246145017,"owners_count":20730493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiohttp-client","opensensemap-api","osem","pydantic-v2"],"created_at":"2024-12-09T05:11:40.659Z","updated_at":"2025-10-29T16:19:44.265Z","avatar_url":"https://github.com/hf-kklein.png","language":"Python","readme":"# osem-python-client\n`osemclient` is an async Python client with fully typed model classes for the OpenSenseMap REST API.\nIt is based on aiohttp and Pydantic.\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n![PyPI status badge](https://img.shields.io/pypi/v/osemclient)\n![Python Versions (officially) supported](https://img.shields.io/pypi/pyversions/osemclient.svg)\n\n![Unittests status badge](https://github.com/hf-kklein/osem-python-client/workflows/Unittests/badge.svg)\n![Coverage status badge](https://github.com//hf-kklein/osem-python-client/workflows/Coverage/badge.svg)\n![Linting status badge](https://github.com/hf-kklein/osem-python-client/workflows/Linting/badge.svg)\n![Black status badge](https://github.com/hf-kklein/osem-python-client/workflows/Formatting/badge.svg)\n\n\n## Usage\n```bash\npip install osemclient\n```\n\n```python\nimport asyncio\nfrom osemclient.client import OpenSenseMapClient\n\n\nasync def get_recent_measurements(sensebox_id: str):\n    \"\"\"\n    downloads the latest 10_000 measurements for the given sensebox id\n    \"\"\"\n    client = OpenSenseMapClient()\n    try:\n        measurements = [x async for x in client.get_measurements_with_sensor_metadata(sensebox_id=sensebox_id)]\n        print(\n            f\"There are {len(measurements)} measurements available: \"\n            + \", \".join(str(ms) for ms in measurements[0:3])\n            + \" ...\"\n        )\n        assert any(m for m in measurements if m.unit == \"°C\")  # there are temperature measurements\n        assert any(m for m in measurements if m.unit == \"hPa\")  # there are air pressure measurements\n        # and many more\n    finally:\n        await client.close_session()\n\n\nif __name__ == \"__main__\":\n    asyncio.run(get_recent_measurements(sensebox_id=\"621f53cdb527de001b06ad5e\"))\n\n```\nMethods that return measurement values are async generators.\nThis allows for kind of streaming the data from the OSeM API and avoids large bloating lists in memory.\n\n## State of this Project\nThis project is **very alpha** and more a proof of concept.\nIt only supports two GET API endpoints as of 2023-12-18 and even those are not covered completely.\nIf you _really_ want to use it, there's still work to be done but this project might be a good foundation.\n\n## Development\nCheck the instructions in our [Python Template Repository](https://github.com/Hochfrequenz/python_template_repository#how-to-use-this-repository-on-your-machine).\ntl;dr: tox.\n\n## Contribute\nYou are very welcome to contribute to this template repository by opening a pull request against the main branch.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhf-kklein%2Fosem-python-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhf-kklein%2Fosem-python-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhf-kklein%2Fosem-python-client/lists"}