{"id":18298392,"url":"https://github.com/fusionauth/fusionauth-python-client","last_synced_at":"2025-04-05T20:05:12.616Z","repository":{"id":39174722,"uuid":"154555801","full_name":"FusionAuth/fusionauth-python-client","owner":"FusionAuth","description":"FusionAuth Python Client","archived":false,"fork":false,"pushed_at":"2025-03-31T22:28:15.000Z","size":340,"stargazers_count":25,"open_issues_count":8,"forks_count":12,"subscribers_count":11,"default_branch":"develop","last_synced_at":"2025-04-01T16:56:44.192Z","etag":null,"topics":["fusionauth","fusionauth-client","python","python3","rest-client"],"latest_commit_sha":null,"homepage":"https://fusionauth.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FusionAuth.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-24T19:16:25.000Z","updated_at":"2025-03-28T16:31:13.000Z","dependencies_parsed_at":"2023-10-11T03:19:04.939Z","dependency_job_id":"d2793559-1efc-47eb-9051-4c9bbeec671d","html_url":"https://github.com/FusionAuth/fusionauth-python-client","commit_stats":{"total_commits":282,"total_committers":14,"mean_commits":"20.142857142857142","dds":"0.32978723404255317","last_synced_commit":"a25d1ee363eef4f3197943cc8ac6b8fe8fe8c3d0"},"previous_names":[],"tags_count":160,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-python-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-python-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-python-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-python-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FusionAuth","download_url":"https://codeload.github.com/FusionAuth/fusionauth-python-client/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393566,"owners_count":20931812,"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":["fusionauth","fusionauth-client","python","python3","rest-client"],"created_at":"2024-11-05T15:05:56.534Z","updated_at":"2025-04-05T20:05:12.585Z","avatar_url":"https://github.com/FusionAuth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FusionAuth Python Client ![semver 2.0.0 compliant](http://img.shields.io/badge/semver-2.0.0-brightgreen.svg?style=flat-square)\n\n## Intro\n\n\u003c!--\ntag::forDocSite[]\n--\u003e\n\nIf you're integrating FusionAuth with a Python 3 application, this library will speed up your development time. Please also make sure to check our [SDK Usage Suggestions page](https://fusionauth.io/docs/sdks/#usage-suggestions).\n\nFor additional information and documentation on FusionAuth refer to [https://fusionauth.io](https://fusionauth.io).\n\n## Install\nTo install the FusionAuth Python Client package run:\n\n```bash\npip install fusionauth-client\n```\n\nThis library can be found on PyPI at https://pypi.org/project/fusionauth-client/.\n\n## Examples\n\n### Set Up\n\nFirst, you have to make sure you have a running FusionAuth instance. If you don't have one already, the easiest way to install FusionAuth is [via Docker](https://fusionauth.io/docs/get-started/download-and-install/docker), but there are [other ways](https://fusionauth.io/docs/get-started/download-and-install). By default, it'll be running on `localhost:9011`.\n\nThen, you have to [create an API Key](https://fusionauth.io/docs/apis/authentication#managing-api-keys) in the admin UI to allow calling API endpoints.\n\nYou are now ready to use this library.\n\n### Create the Client\n\nInclude the package in your code by using the following statement.\n\n```python\nfrom fusionauth.fusionauth_client import FusionAuthClient\n```\n\nNow you're ready to begin making requests to FusionAuth. You will need to supply an API key you created in FusionAuth, the following example assumes an API key of `6b87a398-39f2-4692-927b-13188a81a9a3`.\n\n```python\nclient = FusionAuthClient('6b87a398-39f2-4692-927b-13188a81a9a3', 'http://localhost:9011')\n```\n\n### Error Handling\n\nAfter every request is made, you need to check for any errors and handle them. To avoid cluttering things up, we'll omit the error handling in the next examples, but you should do something like the following.\n\n\n### Create an Application\n\nTo create an [Application](https://fusionauth.io/docs/get-started/core-concepts/applications), use the `create_application()` method.\n\n```python\ndata = {\n    'application': {\n        'name': 'ChangeBank'\n    }\n}\n\nresult = client.create_application(data)\n\n# Handle errors as shown in the beginning of the Examples section\n\n# Otherwise parse the successful response\nprint(result.success_response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/applications#create-an-application)\n\n### Adding Roles to an Existing Application\n\nTo add [roles to an Application](https://fusionauth.io/docs/get-started/core-concepts/applications#roles), use `create_application_role()`.  \n\n```python\ndata = {\n    'role': {\n        'name': 'customer',\n        'description': 'Default role for regular customers',\n        'isDefault': 1\n    }\n}\n\nresult = client.create_application_role(\n    application_id='5a89377e-a250-4b15-b766-377ecc9b9fc9',\n    request=data\n)\n\n# Handle errors as shown in the beginning of the Examples section\n\n# Otherwise parse the successful response\nprint(result.success_response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/applications#create-an-application-role)\n\n### Retrieve Application Details\n\nTo fetch details about an [Application](https://fusionauth.io/docs/get-started/core-concepts/applications), use `retrieve_application()`. \n\n```python\nresult = client.retrieve_application(\n    application_id='5a89377e-a250-4b15-b766-377ecc9b9fc9'\n)\nprint(result.success_response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/applications#retrieve-an-application)\n\n### Delete an Application\n\nTo delete an [Application](https://fusionauth.io/docs/get-started/core-concepts/applications), use `delete_application()`.\n\n```python\nclient.delete_application(\n    application_id='5a89377e-a250-4b15-b766-377ecc9b9fc9'\n)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/applications#delete-an-application)\n\n### Lock a User\n\nTo [prevent a User from logging in](https://fusionauth.io/docs/get-started/core-concepts/users), use `deactivate_user()`. \n\n```python\nclient.deactivate_user(\n    user_id='231b982c-9304-4642-9bac-492d6917f5aa'\n)\n```\n\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/users#delete-a-user)\n\n### Registering a User\n\nTo [register a User in an Application](https://fusionauth.io/docs/get-started/core-concepts/users#registrations), use `register()`.\n\nThe code below also adds a `customer` role and a custom `appBackgroundColor` property to the User Registration.\n\n```python\nresult = client.register(\n    user_id='231b982c-9304-4642-9bac-492d6917f5aa',\n    request={\n        'registration': {\n            'applicationId': '5a89377e-a250-4b15-b766-377ecc9b9fc9',\n            'roles': [\n                'customer'\n            ],\n            'data': {\n                'appBackgroundColor': '#096324'\n            }\n        }\n    }\n)\nprint(result.success_response)\n```\n\n[Check the API docs for this endpoint](https://fusionauth.io/docs/apis/registrations#create-a-user-registration-for-an-existing-user)\n\n\u003c!--\nend::forDocSite[]\n--\u003e\n\n\n\n## Questions and support\n\nIf you find any bugs in this library, [please open an issue](https://github.com/FusionAuth/fusionauth-python-client/issues). Note that changes to the `FusionAuthClient` class have to be done on the [FusionAuth Client Builder repository](https://github.com/FusionAuth/fusionauth-client-builder/blob/master/src/main/client/python.client.ftl), which is responsible for generating that file.\n\nBut if you have a question or support issue, we'd love to hear from you.\n\nIf you have a paid plan with support included, please [open a ticket in your account portal](https://account.fusionauth.io/account/support/). Learn more about [paid plan here](https://fusionauth.io/pricing).\n\nOtherwise, please [post your question in the community forum](https://fusionauth.io/community/forum/).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/FusionAuth/fusionauth-python-client.\n\nNote: if you want to change the `FusionAuthClient` class, you have to do it on the [FusionAuth Client Builder repository](https://github.com/FusionAuth/fusionauth-client-builder/blob/master/src/main/client/python.client.ftl), which is responsible for generating all client libraries we support.\n\n## License\n\nThis code is available as open source under the terms of the [Apache v2.0 License](https://opensource.org/license/apache-2-0).\n\n## Upgrade Policy\n\nThis library is built automatically to keep track of the FusionAuth API, and may also receive updates with bug fixes, security patches, tests, code samples, or documentation changes.\n\nThese releases may also update dependencies, language engines, and operating systems, as we\\'ll follow the deprecation and sunsetting policies of the underlying technologies that it uses.\n\nThis means that after a dependency (e.g. language, framework, or operating system) is deprecated by its maintainer, this library will also be deprecated by us, and will eventually be updated to use a newer version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusionauth%2Ffusionauth-python-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffusionauth%2Ffusionauth-python-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusionauth%2Ffusionauth-python-client/lists"}