{"id":18750008,"url":"https://github.com/aborgt/pyconvertalert","last_synced_at":"2025-07-01T07:04:54.538Z","repository":{"id":139166356,"uuid":"156304139","full_name":"ABORGT/PyConvertAlert","owner":"ABORGT","description":"Convert arbitrary json alerts to Alert Manager alerts.","archived":false,"fork":false,"pushed_at":"2019-02-19T15:17:03.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T07:03:39.848Z","etag":null,"topics":["alertmanager","python-library","python3"],"latest_commit_sha":null,"homepage":null,"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/ABORGT.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,"zenodo":null}},"created_at":"2018-11-06T00:50:17.000Z","updated_at":"2019-02-19T15:17:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"d84dae13-58c4-4784-8306-428dfdaaff2b","html_url":"https://github.com/ABORGT/PyConvertAlert","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ABORGT/PyConvertAlert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ABORGT%2FPyConvertAlert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ABORGT%2FPyConvertAlert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ABORGT%2FPyConvertAlert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ABORGT%2FPyConvertAlert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ABORGT","download_url":"https://codeload.github.com/ABORGT/PyConvertAlert/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ABORGT%2FPyConvertAlert/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262916587,"owners_count":23383884,"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":["alertmanager","python-library","python3"],"created_at":"2024-11-07T17:09:42.519Z","updated_at":"2025-07-01T07:04:54.526Z","avatar_url":"https://github.com/ABORGT.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/ABORGT/PyConvertAlert.svg?branch=master)](https://travis-ci.org/ABORGT/PyConvertAlert)\n\n# PyConvertAlert\n\nPyConvertAlert makes it easy to take an arbitrary alert from some kind of alerting system (Uptime Robot, Rackspace Intelligence) and convert it into an Alert Manager (Prometheus) alert.\n\n\n### Getting Started\n\nThe latest stable release is available from PyPI:\n\n```\npip install pyconvertalert\n```\n\nOtherwise you can install from git:\n\n```\npip install git+https://github.com/jpavlav/PyConvertAlert\n```\n\n### Usage\n\n```python\n\u003e\u003e\u003e from pyconvertalert import Converter\n\u003e\u003e\u003e\n\u003e\u003e\u003e test_lookup_dict_1 = {\n...     \"values\": [\n...         {\n...             \"people\": [\n...                 {\n...                     \"email\": \"jim@jim.com\",\n...                     \"phone\": \"111-111-1111\"\n...                 }\n...             ]\n...         }\n...     ]\n... }\n\u003e\u003e\u003e\n\u003e\u003e\u003e\n\u003e\u003e\u003e test_mapper_dict_1 = {\n...     \"labels\": {\n...         \"email_address\": \"email\",\n...         \"phone_number\": \"phone\"\n...     }\n... }\n\u003e\u003e\u003e convert = Converter(mapper=test_mapper_dict_1)\n\u003e\u003e\u003e convert.convert_it(test_lookup_dict_1)\n{'labels': {'email_address': 'jim@jim.com', 'phone_number': '111-111-1111'}}\n```\n\n### Further Usage\nIn some cases, there will be more than one key that matches a lookup. In this\ncase, the value returned in our converted dict will be a list containing all of\nthe values that match this key. In order to handle a situation where we need to\nbe more specific, it is possible to specify a list of keys to drill down on a\nspecific value. Here is an example:\n\n```python\n\u003e\u003e\u003e test_lookup_dict_2 = {\n...     \"flowers\": [\n...         {\n...             \"best_flower\": {\n...                 \"name\": \"Orchid\",\n...                 \"scientific_name\": \"Orchidaceae\"\n...             },\n...             \"wild_flower\": {\n...                 \"name\": \"Gold Yarrow\",\n...                 \"scientific_name\": \"Achillea filipendulinaa\"\n...             }\n...         }\n...     ]\n... }\n\u003e\u003e\u003e\n\u003e\u003e\u003e test_mapper_dict_2 = {\n...     \"labels\": {\n...         \"best_flower_name\": ['best_flower', 'name'],\n...         \"best_flower_scientific_name\": ['best_flower',\n...                                         'scientific_name']\n...     }\n... }\n\u003e\u003e\u003e\n\u003e\u003e\u003e\n\u003e\u003e\u003e convert = Converter(mapper=test_mapper_dict_2)\n\u003e\u003e\u003e convert.convert_it(test_lookup_dict_2)\n{'labels': {'best_flower_name': 'Orchid', 'best_flower_scientific_name': 'Orchidaceae'}}\n```\nAbove, we see that we were able to get the 'best_flower' 'scientific_name' by\nspecifying a list of keys to search through. We first return the value from the key 'best_flower', then return the value from the key 'name'.\n## Running the tests\n\nShould be as simple as:\n\n```\npython -m unittest test_py_convert_alert.py\n```\n\n## Contributing\n1. Fork it.\n2. Create a branch describing either the issue or feature you're working.\n3. Making changes, committing along the way.\n4. Follow PEP8, except where ridiculous.\n5. Include tests for any functionality changes.\n6. Push the changes and create a pull request :D.\n\n## Built With\n\n* [Python3](https://www.python.org/downloads/) - Beautiful language.\n\n## Authors\n\n* **Justin Palmer** - *Urrverything* - [Me](https://github.com/jpavlav)\n\n## Acknowledgments\n\n* Kenneth Reitz -\u003e [setup](https://github.com/kennethreitz/setup.py) - Thanks!\n* Kamori -\u003e [Cool Guy](https://github.com/Kamori) - Thanks to you as well!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faborgt%2Fpyconvertalert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faborgt%2Fpyconvertalert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faborgt%2Fpyconvertalert/lists"}