{"id":37079837,"url":"https://github.com/codeaffen/phpypam","last_synced_at":"2026-01-14T09:39:36.680Z","repository":{"id":37079306,"uuid":"300665687","full_name":"codeaffen/phpypam","owner":"codeaffen","description":"Python API client library for phpIPAM installations","archived":false,"fork":false,"pushed_at":"2025-06-15T14:43:11.000Z","size":137,"stargazers_count":11,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-09-29T01:09:20.292Z","etag":null,"topics":["api","hacktoberfest","library","phpipam","phpipam-api","python","python-library"],"latest_commit_sha":null,"homepage":"https://codeaffen.org/projects/phpypam","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeaffen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-10-02T15:55:41.000Z","updated_at":"2025-06-15T14:43:14.000Z","dependencies_parsed_at":"2023-10-01T19:21:51.139Z","dependency_job_id":"92a9dcb8-2eb0-4439-a880-9f5156b3b67e","html_url":"https://github.com/codeaffen/phpypam","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/codeaffen/phpypam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaffen%2Fphpypam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaffen%2Fphpypam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaffen%2Fphpypam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaffen%2Fphpypam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeaffen","download_url":"https://codeload.github.com/codeaffen/phpypam/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeaffen%2Fphpypam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","hacktoberfest","library","phpipam","phpipam-api","python","python-library"],"created_at":"2026-01-14T09:39:35.793Z","updated_at":"2026-01-14T09:39:36.673Z","avatar_url":"https://github.com/codeaffen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# phpypam: Python API client library for phpIPAM installation\n\n[![PyPI version](https://badge.fury.io/py/phpypam.svg)](https://badge.fury.io/py/phpypam)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ed3511c33a254bfe942777c9ef3251e3)](https://www.codacy.com/gh/codeaffen/phpypam/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=codeaffen/phpypam\u0026amp;utm_campaign=Badge_Grade)\n[![Documentation Status](https://readthedocs.org/projects/phpypam/badge/?version=latest)](https://phpypam.readthedocs.io/en/latest/?badge=latest)\n\nAs we started to develop phpipam-ansible-modules we used an existing python library for phpIPAM API. As we needed a good error handling and we don't expect a quick fix of existing project we started to develop our own library.\n\n## installation\n\nThis library is hosted on [pypi.org](https://pypi.org/project/phpypam/), so you can simply use `pip` to install it.\n\n~~~bash\npip install phpypam\n~~~\n\nAlternatively you can install it from source. You need to do the following:\n\n~~~bash\n$ git clone https://github.com/codeaffen/phpypam.git\nCloning into 'phpypam'...\nremote: Enumerating objects: 1, done.\nremote: Counting objects: 100% (1/1), done.\nremote: Total 366 (delta 0), reused 0 (delta 0), pack-reused 365\nReceiving objects: 100% (366/366), 88.57 KiB | 521.00 KiB/s, done.\nResolving deltas: 100% (187/187), done.\n$ cd phpypam/\n$ python setup.py install\n~~~\n\n## quick start\n\nTo start using `phpypam` you simply have to write some lines of code.\n\n~~~python\nimport phpypam\n\npi = phpypam.api(\n  url='https://ipam.example.com',\n  app_id='ansible',\n  username='apiuser',\n  password='apiP455wd',\n  ssl_verify=True\n)\npi.get_entity(controller='sections')\n~~~\n\n## making api connection\n\nTo connect to phpIPAM API you need some parameters to authenticate against the phpIPAM instance.\n\nParameter | Description | Default |\n:-------- | :---------- | :------ |\nurl | The URL to a phpIPAM instance. It includes the protocol (http or https). | |\napp_id | The app_id which is used for the API operations. |\nusername | The `username` which is used to connect to API. | None |\npassword | The `password` to authenticate `username` against API. | None |\nssl_verify | Should certificate of endpoint verified or not. Useful if you use a self signed certificate. | True |\n\n*Example* connect to api and request current token:\n\n~~~python\nconnection_params = dict(\nurl='https://ipam.example.com',\n  app_id='ansible',\n  username='apiuser',\n  password='apiP455wd',\n  ssl_verify=True\n)\n\npi = phpypam.api(**connection_params)\n\ntoken = pi.get_token()\n~~~\n\nFirst of all you create a dictionary with the connection data. This dictionary will unpacked for creating a `phpypam.api` object.\n\nIf all went well you can use the `get_token` to get the currently valid token from API.\n\n## get available controllers\n\nTo work with the phpIPAM api it is useful if you know all available controllers. To achieve this you can either read the api documentation or you can use the `controllers` method.\n\n~~~python\ncontrollers = pi.controllers()\n~~~\n\nThe method returns a set with all supported controllers.\n\n## get an entity\n\nTo get an entity the `get_entity` method has to be used.\n\n~~~python\nget_entity(controller, controller_path=None, params=None)\n~~~\n\n*Example* get a `section` by name:\n\n~~~python\nentity = pi.get_entity(controller='sections', controller_path='foobar')\n~~~\n\nThis call returns a dictionary for the entity with the name `foobar`.\n\n## create an entity\n\nTo create an entity the `create_entity` method has to be used.\n\n~~~python\ncreate_entity(controller, controller_path=None, data=None, params=None)\n~~~\n\n*Example* create a `section` if it does not exists:\n\n~~~python\nmy_section = dict(\n    name='foobar',\n    description='new section',\n    permissions='{\"3\":\"1\",\"2\":\"2\"}'\n)\n\ntry:\n    entity = pi.get_entity(controller='sections', controller_path=my_section['name'])\nexcept PHPyPAMEntityNotFoundException:\n    print('create entity')\n    entity = pi.create_entity(controller='sections', data=my_section)\n\n~~~\n\nIn this example first we check if the section we work on already exists. If the PHPyPAMEntityNotFoundException is raised we create the entity.\n\n## update an entity\n\nTo update an entity you have to use the `update_entity` method.\n\n~~~python\nupdate_entity(controller, controller_path=None, data=None, params=None)\n~~~\n\n*Example* update a `section` if it exists:\n\n~~~python\nmy_section['description'] = 'new description'\n\nentity = pi.get_entity(controller='sections', controller_path=my_section['name'])\npi.update_entity(controller='sections', controller_path=entity['id'], data=my_section)\n~~~\n\nTo change data you have to modify the value of the desired key to the value you want. You can see the data is changed in the dict from the former example.\nThen you get the entity to obtain its id to work on.\n\n**Note:** All modifying operations need the id of an entity not the name.\n\nIn the last step you call `update_entity` and put the entity id in parameter `controller_path` with the `data` parameter you provide the fully entity description dictionary.\n\n## delete an entity\n\nTo delete an entity you have to use the `delete_entity` method.\n\n~~~python\ndelete_entity(controller, controller_path, params=None)\n~~~\n\n*Example* delete a existing section:\n\n~~~python\nentity = pi.get_entity(controller='sections', controller_path=my_section['name'])\npi.delete_entity(controller='sections', controller_path=entity['id'])\n~~~\n\nIn this example you request the entity you had created/updated in the above examples.\nAfter that you call `delete_entity` with the entity id from the request before.\n\n## possible exceptions\n\n* ***PHPyPAMInvalidCredentials*** - will be raised if something goes wrong with the authentication\n* ***PHPyPAMEntityNotFoundException*** - will be raised if an entity does not exists\n* ***PHPyPAMInvalidSyntax*** - will be raised for requests which will be answered with status code 400 from API\n* ***PHPyPAMException*** - for any errors which we catch but no specific exception exists this exception wil be raised\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeaffen%2Fphpypam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeaffen%2Fphpypam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeaffen%2Fphpypam/lists"}