passbolt-python-api


Namepassbolt-python-api JSON
Version 0.3.8 PyPI version JSON
download
home_pagehttps://github.com/shubhamdipt/passbolt-python-api
SummaryA python client for Passbolt.
upload_time2024-12-11 14:56:32
maintainerNone
docs_urlNone
authorShubham Dipt
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements certifi chardet charset-normalizer idna python-gnupg requests typing-extensions urllib3
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Passbolt-python-API

It is a python api client for Passbolt.

#### Disclaimer
* This project is a community driven project that is not associated with Passbolt S.A.
* Passbolt and the Passbolt logo are registered trademarks of Passbolt S.A.

## Installation

    $pip install passbolt-python-api 

## Dependencies

  - Python >= 3.6
  - GPG (also known as GnuPG) software

## Configuration

Create a config file with the following contents.

    [PASSBOLT]
    SERVER = http://<server_ip or domain>
    SERVER_PUBLIC_KEY_FILE = <optional: server_public.asc>
    USER_FINGERPRINT = <user_fingerprint>
    USER_PUBLIC_KEY_FILE = <optional: passbolt_public.asc>
    USER_PRIVATE_KEY_FILE = <optional: passbolt_private.asc>
    PASSPHRASE = <passbolt_password>
    SERVER_CERT_AUTH_KEY= <optional: client.pem>
    SERVER_CERT_AUTH_CRT= <optional: client.crt>

Or as a dictionary

    config = {
        "PASSBOLT": {
            "SERVER": "http://<server_ip or domain>"
            ....(same as above)
        }
    }

## Usage


### Import GPG keys from Passbolt

The first step will be to import the private and public keys using gpg for encryption.

Note: Do not keep private and public files. Rather just import them using gpg command one time and delete those files.

#### Using Python
To import new keys using Python:

    >>>import passboltapi
    >>>passbolt = passboltapi.PassboltAPI(config_path="config.ini", new_keys=True)
    
To delete old keys and import only the new ones.

    >>>import passboltapi
    >>>passbolt = passboltapi.PassboltAPI(config_path="config.ini", new_keys=True, delete_old_keys=True)

To use with client certificate authentication use `SERVER_CERT_AUTH_CRT` and `SERVER_CERT_AUTH_KEY` (pem) in config file and:

    >>>import passboltapi
    >>>passbolt = passboltapi.PassboltAPI(config_path="config.ini", cert_auth=True)

#### Using GPG

Import new keys:

    $gpg --import public.asc
    $gpg --batch --import private.asc

Deleting existing keys:

    $gpg --delete-secret-keys <fingerprint>
    $gpg --delete-key <fingerprint>


## How to use PassboltAPI client

    >>>import passboltapi
    >>>passbolt = passboltapi.PassboltAPI(config_path="config.ini")
    # Or pass the configuration settings as a dict
    >>>passbolt = passboltapi.PassboltAPI(config=<dictionary as the given example config.ini>)
    
    # Now you may do any get, post, put and delete request.
    >>>r = passbolt.get(url="/resources.json?api-version=v2")
    >>>r = passbolt.post(self.server_url + url, json=data)
    
    # One can also use it as context manager
    >>>with passboltapi.PassboltAPI(config_path="config.ini") as passbolt:

    # One needs to periodically import the public keys from the passbolt server to their local gpg
    >>>passbolt.import_public_keys("TRUST_FULLY")


To get all resources

    resources = {record.username: record for record in passbolt.list_resources(folder_id=folder_id)}

To create new resource (optional: folder)
    
    response = passbolt.create_resource(
        name=name,
        username=username,
        password=password,
        uri=uri, # optional
        description=description,  # optional
        folder_id=passbolt_folder_id  # optional
    )
    # Note: if you add folder_id, you need to have the public keys of all the users who have access to the foler.
    # This can be easily achieved as follows:
    passbolt.import_public_keys()

To move resource to folder

    passbolt.move_resource_to_folder(resource_id, folder_id)


### Sample test
Check test.py for an example.

If new keys needs to be imported, then USER_PUBLIC_KEY_FILE and USER_PRIVATE_KEY_FILE settings
should be in the config ini having the path of the public and private keys file respectively.


### Passbolt API

For more API related questions, visit Passbolt API documentation:

<https://help.passbolt.com/api>



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/shubhamdipt/passbolt-python-api",
    "name": "passbolt-python-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Shubham Dipt",
    "author_email": "shubham.dipt@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4c/18/4358edeb5cc034c9e92ac235a7370cc6f6a4c877fffcd10626e7f211a9e0/passbolt-python-api-0.3.8.tar.gz",
    "platform": "any",
    "description": "# Passbolt-python-API\n\nIt is a python api client for Passbolt.\n\n#### Disclaimer\n* This project is a community driven project that is not associated with Passbolt S.A.\n* Passbolt and the Passbolt logo are registered trademarks of Passbolt S.A.\n\n## Installation\n\n    $pip install passbolt-python-api \n\n## Dependencies\n\n  - Python >= 3.6\n  - GPG (also known as GnuPG) software\n\n## Configuration\n\nCreate a config file with the following contents.\n\n    [PASSBOLT]\n    SERVER = http://<server_ip or domain>\n    SERVER_PUBLIC_KEY_FILE = <optional: server_public.asc>\n    USER_FINGERPRINT = <user_fingerprint>\n    USER_PUBLIC_KEY_FILE = <optional: passbolt_public.asc>\n    USER_PRIVATE_KEY_FILE = <optional: passbolt_private.asc>\n    PASSPHRASE = <passbolt_password>\n    SERVER_CERT_AUTH_KEY= <optional: client.pem>\n    SERVER_CERT_AUTH_CRT= <optional: client.crt>\n\nOr as a dictionary\n\n    config = {\n        \"PASSBOLT\": {\n            \"SERVER\": \"http://<server_ip or domain>\"\n            ....(same as above)\n        }\n    }\n\n## Usage\n\n\n### Import GPG keys from Passbolt\n\nThe first step will be to import the private and public keys using gpg for encryption.\n\nNote: Do not keep private and public files. Rather just import them using gpg command one time and delete those files.\n\n#### Using Python\nTo import new keys using Python:\n\n    >>>import passboltapi\n    >>>passbolt = passboltapi.PassboltAPI(config_path=\"config.ini\", new_keys=True)\n    \nTo delete old keys and import only the new ones.\n\n    >>>import passboltapi\n    >>>passbolt = passboltapi.PassboltAPI(config_path=\"config.ini\", new_keys=True, delete_old_keys=True)\n\nTo use with client certificate authentication use `SERVER_CERT_AUTH_CRT` and `SERVER_CERT_AUTH_KEY` (pem) in config file and:\n\n    >>>import passboltapi\n    >>>passbolt = passboltapi.PassboltAPI(config_path=\"config.ini\", cert_auth=True)\n\n#### Using GPG\n\nImport new keys:\n\n    $gpg --import public.asc\n    $gpg --batch --import private.asc\n\nDeleting existing keys:\n\n    $gpg --delete-secret-keys <fingerprint>\n    $gpg --delete-key <fingerprint>\n\n\n## How to use PassboltAPI client\n\n    >>>import passboltapi\n    >>>passbolt = passboltapi.PassboltAPI(config_path=\"config.ini\")\n    # Or pass the configuration settings as a dict\n    >>>passbolt = passboltapi.PassboltAPI(config=<dictionary as the given example config.ini>)\n    \n    # Now you may do any get, post, put and delete request.\n    >>>r = passbolt.get(url=\"/resources.json?api-version=v2\")\n    >>>r = passbolt.post(self.server_url + url, json=data)\n    \n    # One can also use it as context manager\n    >>>with passboltapi.PassboltAPI(config_path=\"config.ini\") as passbolt:\n\n    # One needs to periodically import the public keys from the passbolt server to their local gpg\n    >>>passbolt.import_public_keys(\"TRUST_FULLY\")\n\n\nTo get all resources\n\n    resources = {record.username: record for record in passbolt.list_resources(folder_id=folder_id)}\n\nTo create new resource (optional: folder)\n    \n    response = passbolt.create_resource(\n        name=name,\n        username=username,\n        password=password,\n        uri=uri, # optional\n        description=description,  # optional\n        folder_id=passbolt_folder_id  # optional\n    )\n    # Note: if you add folder_id, you need to have the public keys of all the users who have access to the foler.\n    # This can be easily achieved as follows:\n    passbolt.import_public_keys()\n\nTo move resource to folder\n\n    passbolt.move_resource_to_folder(resource_id, folder_id)\n\n\n### Sample test\nCheck test.py for an example.\n\nIf new keys needs to be imported, then USER_PUBLIC_KEY_FILE and USER_PRIVATE_KEY_FILE settings\nshould be in the config ini having the path of the public and private keys file respectively.\n\n\n### Passbolt API\n\nFor more API related questions, visit Passbolt API documentation:\n\n<https://help.passbolt.com/api>\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A python client for Passbolt.",
    "version": "0.3.8",
    "project_urls": {
        "Homepage": "https://github.com/shubhamdipt/passbolt-python-api"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "673fa39235d36a96428ce0388dd296dc22a1d476db38132d9d7a0dfcf90c503a",
                "md5": "c2dce42ab854bd99efc07cc4c046b38f",
                "sha256": "b6baeb901cc8a46006cd4b818adedfbcfe1bf5f138fefaac82893c8b9ad1a8f0"
            },
            "downloads": -1,
            "filename": "passbolt_python_api-0.3.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c2dce42ab854bd99efc07cc4c046b38f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10387,
            "upload_time": "2024-12-11T14:56:30",
            "upload_time_iso_8601": "2024-12-11T14:56:30.780778Z",
            "url": "https://files.pythonhosted.org/packages/67/3f/a39235d36a96428ce0388dd296dc22a1d476db38132d9d7a0dfcf90c503a/passbolt_python_api-0.3.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4c184358edeb5cc034c9e92ac235a7370cc6f6a4c877fffcd10626e7f211a9e0",
                "md5": "bfefcae8c6c29cc46fc91504a4966e97",
                "sha256": "5b50caf16dc280190123d28661af84dfa57dd9c3179225ceabc9a17ec7fb3664"
            },
            "downloads": -1,
            "filename": "passbolt-python-api-0.3.8.tar.gz",
            "has_sig": false,
            "md5_digest": "bfefcae8c6c29cc46fc91504a4966e97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9961,
            "upload_time": "2024-12-11T14:56:32",
            "upload_time_iso_8601": "2024-12-11T14:56:32.038824Z",
            "url": "https://files.pythonhosted.org/packages/4c/18/4358edeb5cc034c9e92ac235a7370cc6f6a4c877fffcd10626e7f211a9e0/passbolt-python-api-0.3.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 14:56:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shubhamdipt",
    "github_project": "passbolt-python-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "certifi",
            "specs": [
                [
                    ">=",
                    "2019.6.16"
                ]
            ]
        },
        {
            "name": "chardet",
            "specs": [
                [
                    ">=",
                    "3.0.4"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    ">=",
                    "2.0.8"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    ">=",
                    "2.8"
                ]
            ]
        },
        {
            "name": "python-gnupg",
            "specs": [
                [
                    ">=",
                    "0.4.7"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.26.0"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    ">=",
                    "1.25.3"
                ]
            ]
        }
    ],
    "lcname": "passbolt-python-api"
}
        
Elapsed time: 0.39650s