s6r-bitwarden-cli


Names6r-bitwarden-cli JSON
Version 1.0.5 PyPI version JSON
download
home_page
SummaryInteract easily with Bitwarden client
upload_time2024-01-23 14:20:18
maintainer
docs_urlNone
author
requires_python>=3.9
licenseGNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
keywords bitwarden vault python cli bw
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # s6r-bitwarden-cli

Interact easily with Bitwarden client.

## Overview

s6r-bitwarden-cli is a Python script designed to provide a convenient interface for interacting with the
Bitwarden command-line interface (CLI) tool. It allows users to perform various Bitwarden actions, such as logging in,
searching for items, retrieving item details, collections, organizations, directly from within a Python script.


## Table of Contents

- [Installation](#installation)
    - [Install s6r-bitwarden-cli](#install-s6r-bitwarden-cli)
    - [Install Bitwarden CLI](#install-bitwarden-cli)
- [Usage](#usage)
- [Login to Bitwarden Vault](#login-to-bitwarden-vault)
    - [Login with Username and Password](#login-with-username-and-password)
    - [Login with API Key](#login-with-api-key)
    - [Unlock with Session Key](#unlock-with-session-key)
- [Examples](#examples)
- [License](#license)
- [Contributing](#contributing)
- [Contributors](#contributors)
- [Maintainer](#maintainer)




## Installation

```bash
    pip install s6r-bitwarden-cli
```

### Install Bitwarden CLI

Make sure to install the Bitwarden CLI tool on your system. 
You can download it from the official Bitwarden website or use your package manager.

[Download and install](https://bitwarden.com/help/cli/#download-and-install)


## Usage

```python
from s6r_bitwarden_cli import BitwardenCli

bw_cli = BitwardenCli()
password = bw_cli.get_item_password('Staging', collection_name='My collection')
```

The `get_item_password` method, when used with correctly set environment variables, abstracts the complexities of
Bitwarden authentication and CLI interactions, providing a seamless way to retrieve passwords for specified items.

## Login to Bitwarden Vault

To log in to your Bitwarden Vault, you have multiple options based on your preferred authentication method.

### Login with Username and Password

Set the following environment variables to log in using your Bitwarden username and password:

- `BITWARDEN_USERNAME`: Your Bitwarden username.
- `BITWARDEN_PASSWORD`: Your Bitwarden password.

```bash
export BITWARDEN_USERNAME=your_username
export BITWARDEN_PASSWORD=your_password
```

### Login with API Key

If you prefer to use an API key for authentication, set the following environment variables:

- `BITWARDEN_API_CLIENT_ID`: Your Bitwarden API client ID.
- `BITWARDEN_API_CLIENT_SECRET`: Your Bitwarden API client secret.

Note: The `BITWARDEN_PASSWORD` environment variable is still required to unlock the vault, even when using API key
authentication.

```bash
export BITWARDEN_API_CLIENT_ID=your_api_client_id
export BITWARDEN_API_CLIENT_SECRET=your_api_client_secret
```

### Unlock with Session Key

If you are already logged in and have a session key, 
set the BITWARDEN_SESSION_KEY environment variable to unlock the vault.

This method allows you to bypass the username and password or API key authentication if you have an active session.

```bash
export BITWARDEN_SESSION_KEY=your_session_key
```

## Examples
```python
# Initialize Bitwarden CLI
from s6r_bitwarden_cli import BitwardenCli
bw = BitwardenCli(username='your_username', password='your_password', verbose=True)

# Check Bitwarden session status
status = bw.get_status()

# Perform login
bw.login()

# Unlock Bitwarden vault
bw.unlock()

# Search for Bitwarden items
items = bw.search_objects(objects='items', search='keyword')

# Retrieve details of a Bitwarden item
item_details = bw.get_item(name='item_name')

# Get a list of Bitwarden organizations
organizations = bw.get_organizations()

# Get the default organization
default_organization = bw.get_default_organization()

# Get the ID of the default organization
default_organization_id = bw.get_default_organization_id()

# Get organization collections
org_collections = bw.get_org_collections(search='collection_name', organization_id='organization_id')

# Get an organization collection
org_collection = bw.get_org_collection(search='collection_name', organization_id='organization_id')

# Get the ID of an organization collection
org_collection_id = bw.get_org_collection_id(search='collection_name', organization_id='organization_id')

# logout from Bitwarden
bw.logout()
```

## License

This project is licensed under the [GNU Lesser General Public License (LGPL) Version 3](https://www.gnu.org/licenses/lgpl-3.0.html).


## Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements,
please open an issue or submit a pull request.

- GitHub Repository: [ScalizerOrg/s6r-bitwarden-cli](https://github.com/ScalizerOrg/s6r-bitwarden-cli)

## Contributors

* Michel Perrocheau - [Github](https://github.com/myrrkel)


## Maintainer

This software is maintained by [Scalizer](https://www.scalizer.fr).


<div style="text-align: center;">

[![Scaliser](./logo_scalizer.png)](https://www.scalizer.fr)

</div>

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "s6r-bitwarden-cli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "bitwarden,vault,python,cli,bw",
    "author": "",
    "author_email": "Michel Perrocheau <michel@scalizer.fr>",
    "download_url": "https://files.pythonhosted.org/packages/1a/9f/150517bc78cd7bafb89c3f5895e3a7fd00de3abdaf6a9f8a427df1e5ea88/s6r-bitwarden-cli-1.0.5.tar.gz",
    "platform": null,
    "description": "# s6r-bitwarden-cli\n\nInteract easily with Bitwarden client.\n\n## Overview\n\ns6r-bitwarden-cli is a Python script designed to provide a convenient interface for interacting with the\nBitwarden command-line interface (CLI) tool. It allows users to perform various Bitwarden actions, such as logging in,\nsearching for items, retrieving item details, collections, organizations, directly from within a Python script.\n\n\n## Table of Contents\n\n- [Installation](#installation)\n    - [Install s6r-bitwarden-cli](#install-s6r-bitwarden-cli)\n    - [Install Bitwarden CLI](#install-bitwarden-cli)\n- [Usage](#usage)\n- [Login to Bitwarden Vault](#login-to-bitwarden-vault)\n    - [Login with Username and Password](#login-with-username-and-password)\n    - [Login with API Key](#login-with-api-key)\n    - [Unlock with Session Key](#unlock-with-session-key)\n- [Examples](#examples)\n- [License](#license)\n- [Contributing](#contributing)\n- [Contributors](#contributors)\n- [Maintainer](#maintainer)\n\n\n\n\n## Installation\n\n```bash\n    pip install s6r-bitwarden-cli\n```\n\n### Install Bitwarden CLI\n\nMake sure to install the Bitwarden CLI tool on your system. \nYou can download it from the official Bitwarden website or use your package manager.\n\n[Download and install](https://bitwarden.com/help/cli/#download-and-install)\n\n\n## Usage\n\n```python\nfrom s6r_bitwarden_cli import BitwardenCli\n\nbw_cli = BitwardenCli()\npassword = bw_cli.get_item_password('Staging', collection_name='My collection')\n```\n\nThe `get_item_password` method, when used with correctly set environment variables, abstracts the complexities of\nBitwarden authentication and CLI interactions, providing a seamless way to retrieve passwords for specified items.\n\n## Login to Bitwarden Vault\n\nTo log in to your Bitwarden Vault, you have multiple options based on your preferred authentication method.\n\n### Login with Username and Password\n\nSet the following environment variables to log in using your Bitwarden username and password:\n\n- `BITWARDEN_USERNAME`: Your Bitwarden username.\n- `BITWARDEN_PASSWORD`: Your Bitwarden password.\n\n```bash\nexport BITWARDEN_USERNAME=your_username\nexport BITWARDEN_PASSWORD=your_password\n```\n\n### Login with API Key\n\nIf you prefer to use an API key for authentication, set the following environment variables:\n\n- `BITWARDEN_API_CLIENT_ID`: Your Bitwarden API client ID.\n- `BITWARDEN_API_CLIENT_SECRET`: Your Bitwarden API client secret.\n\nNote: The `BITWARDEN_PASSWORD` environment variable is still required to unlock the vault, even when using API key\nauthentication.\n\n```bash\nexport BITWARDEN_API_CLIENT_ID=your_api_client_id\nexport BITWARDEN_API_CLIENT_SECRET=your_api_client_secret\n```\n\n### Unlock with Session Key\n\nIf you are already logged in and have a session key, \nset the BITWARDEN_SESSION_KEY environment variable to unlock the vault.\n\nThis method allows you to bypass the username and password or API key authentication if you have an active session.\n\n```bash\nexport BITWARDEN_SESSION_KEY=your_session_key\n```\n\n## Examples\n```python\n# Initialize Bitwarden CLI\nfrom s6r_bitwarden_cli import BitwardenCli\nbw = BitwardenCli(username='your_username', password='your_password', verbose=True)\n\n# Check Bitwarden session status\nstatus = bw.get_status()\n\n# Perform login\nbw.login()\n\n# Unlock Bitwarden vault\nbw.unlock()\n\n# Search for Bitwarden items\nitems = bw.search_objects(objects='items', search='keyword')\n\n# Retrieve details of a Bitwarden item\nitem_details = bw.get_item(name='item_name')\n\n# Get a list of Bitwarden organizations\norganizations = bw.get_organizations()\n\n# Get the default organization\ndefault_organization = bw.get_default_organization()\n\n# Get the ID of the default organization\ndefault_organization_id = bw.get_default_organization_id()\n\n# Get organization collections\norg_collections = bw.get_org_collections(search='collection_name', organization_id='organization_id')\n\n# Get an organization collection\norg_collection = bw.get_org_collection(search='collection_name', organization_id='organization_id')\n\n# Get the ID of an organization collection\norg_collection_id = bw.get_org_collection_id(search='collection_name', organization_id='organization_id')\n\n# logout from Bitwarden\nbw.logout()\n```\n\n## License\n\nThis project is licensed under the [GNU Lesser General Public License (LGPL) Version 3](https://www.gnu.org/licenses/lgpl-3.0.html).\n\n\n## Contributing\n\nContributions are welcome! If you find any issues or have suggestions for improvements,\nplease open an issue or submit a pull request.\n\n- GitHub Repository: [ScalizerOrg/s6r-bitwarden-cli](https://github.com/ScalizerOrg/s6r-bitwarden-cli)\n\n## Contributors\n\n* Michel Perrocheau - [Github](https://github.com/myrrkel)\n\n\n## Maintainer\n\nThis software is maintained by [Scalizer](https://www.scalizer.fr).\n\n\n<div style=\"text-align: center;\">\n\n[![Scaliser](./logo_scalizer.png)](https://www.scalizer.fr)\n\n</div>\n",
    "bugtrack_url": null,
    "license": "GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007  Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.   This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.  0. Additional Definitions.  As used herein, \"this License\" refers to version 3 of the GNU Lesser General Public License, and the \"GNU GPL\" refers to version 3 of the GNU General Public License.  \"The Library\" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.  An \"Application\" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.  A \"Combined Work\" is a work produced by combining or linking an Application with the Library.  The particular version of the Library with which the Combined Work was made is also called the \"Linked Version\".  The \"Minimal Corresponding Source\" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.  The \"Corresponding Application Code\" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.  1. Exception to Section 3 of the GNU GPL.  You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.  2. Conveying Modified Versions.  If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:  a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or  b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.  3. Object Code Incorporating Material from Library Header Files.  The object code form of an Application may incorporate material from a header file that is part of the Library.  You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:  a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.  b) Accompany the object code with a copy of the GNU GPL and this license document.  4. Combined Works.  You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:  a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.  b) Accompany the Combined Work with a copy of the GNU GPL and this license document.  c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.  d) Do one of the following:  0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.  1) Use a suitable shared library mechanism for linking with the Library.  A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.  e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)  5. Combined Libraries.  You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:  a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.  b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.  6. Revised Versions of the GNU Lesser General Public License.  The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.  Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License \"or any later version\" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.  If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ",
    "summary": "Interact easily with Bitwarden client",
    "version": "1.0.5",
    "project_urls": {
        "Homepage": "https://github.com/ScalizerOrg/s6r-bitwarden-cli"
    },
    "split_keywords": [
        "bitwarden",
        "vault",
        "python",
        "cli",
        "bw"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc775f2a45b9832b64b6ea038094b64e6a5e8f1bae9b038cba249053bc7a59b6",
                "md5": "47cf126d24e553cb5b7036c1a106ec8d",
                "sha256": "09ece5a82dd4ea358f95ebf4d177200ddbfc1422a282903236e3c2eda02243b0"
            },
            "downloads": -1,
            "filename": "s6r_bitwarden_cli-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "47cf126d24e553cb5b7036c1a106ec8d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11150,
            "upload_time": "2024-01-23T14:20:15",
            "upload_time_iso_8601": "2024-01-23T14:20:15.949056Z",
            "url": "https://files.pythonhosted.org/packages/bc/77/5f2a45b9832b64b6ea038094b64e6a5e8f1bae9b038cba249053bc7a59b6/s6r_bitwarden_cli-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a9f150517bc78cd7bafb89c3f5895e3a7fd00de3abdaf6a9f8a427df1e5ea88",
                "md5": "25b72ba2b54dd2648041d4adb98da3d3",
                "sha256": "5471dcd605f7bf3cfa589cf7f581eb858225a2931447cdd41eb87326f3066b02"
            },
            "downloads": -1,
            "filename": "s6r-bitwarden-cli-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "25b72ba2b54dd2648041d4adb98da3d3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 12686,
            "upload_time": "2024-01-23T14:20:18",
            "upload_time_iso_8601": "2024-01-23T14:20:18.020806Z",
            "url": "https://files.pythonhosted.org/packages/1a/9f/150517bc78cd7bafb89c3f5895e3a7fd00de3abdaf6a9f8a427df1e5ea88/s6r-bitwarden-cli-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-23 14:20:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ScalizerOrg",
    "github_project": "s6r-bitwarden-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "s6r-bitwarden-cli"
}
        
Elapsed time: 0.28969s