GoogleBard1


NameGoogleBard1 JSON
Version 2.1.4 PyPI version JSON
download
home_pagehttps://github.com/Simatwa/Bard
SummaryReverse engineering of Google's Bard chatbot
upload_time2024-03-02 10:46:17
maintainerSmartwa
docs_urlNone
authorAntonio Cheong
requires_python
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bard <img src="https://www.gstatic.com/lamda/images/favicon_v1_150160cddff7f294ce30.svg" width="35px" />
Reverse engineering of Google's Gemini chatbot API, formerly **BARD**.

## Installation
```bash
 $ pip3 install --upgrade GoogleBard1
```

## Authentication
Go to https://bard.google.com/

- F12 for console
- Copy the values
  - Session: Go to Application → Cookies → `__Secure-1PSID` and `__Secure-1PSIDTS`. Copy the value of those cookie.

## Usage

```bash
$ python3 -m Bard -h
usage: Bard.py [-h] --session SESSION --session_ts SESSION_TS

options:
  -h, --help            show this help message and exit
  --session SESSION     __Secure-1PSID cookie
  --session_ts SESSION_TS
                        __secure_1psidts cookie.
```

### Quick mode
```
$ export BARD_QUICK="true"
$ export BARD__Secure_1PSID="<__Secure-1PSID>"
$ export BARD__Secure_1PSIDTS="<__Secure-1PSIDTS>"
$ python3 -m Bard
```
Environment variables can be placed in .zshrc.

Example bash shortcut:
```bash
# USAGE1: bard QUESTION
# USAGE2: echo "QUESTION" | bard
bard () {
	export BARD_QUICK=true
	export BARD__Secure_1PSID=<__Secure-1PSID>
	export BARD__Secure_1PSIDTS=<__Secure-1PSIDTS>
	python3 -m Bard "${@:-$(</dev/stdin)}" | tail -n+7
}
```

### Implementation:
```python
from os import environ
from Bard import Chatbot

Secure_1PSID = environ.get("BARD__Secure_1PSID")
Secure_1PSIDTS = environ.get("BARD__Secure_1PSIDTS")
chatbot = Chatbot(Secure_1PSID, Secure_1PSIDTS)

answer = chatbot.ask("Hello, how are you?")

print(answer['content']
```

### Async Implementation:
```python
import asyncio
from os import environ
from Bard import AsyncChatbot

Secure_1PSID = environ.get("BARD__Secure_1PSID")
Secure_1PSIDTS = environ.get("BARD__Secure_1PSIDTS")

async def main():
    chatbot = await AsyncChatbot.create(Secure_1PSID, Secure_1PSIDTS)
    response = await chatbot.ask("Hello, how are you?")
    print(response['content'])

asyncio.run(main())
```

> [!IMPORTANT]
> The cookies expire after a short period; ensure you update them as frequent as possible.

## [Developer Documentation](https://github.com/Simatwa/Bard/blob/main/DOCUMENTATION.md)

Credits:
- [discordtehe](https://github.com/discordtehe) - Derivative of his original reverse engineering

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Simatwa/Bard",
    "name": "GoogleBard1",
    "maintainer": "Smartwa",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "simatwacaleb@proton.me",
    "keywords": "",
    "author": "Antonio Cheong",
    "author_email": "acheong@student.dalat.org",
    "download_url": "https://files.pythonhosted.org/packages/74/09/4f6616798faf77d175116c693fe50de03869165ce6ed566f642f0270b09a/GoogleBard1-2.1.4.tar.gz",
    "platform": null,
    "description": "# Bard <img src=\"https://www.gstatic.com/lamda/images/favicon_v1_150160cddff7f294ce30.svg\" width=\"35px\" />\nReverse engineering of Google's Gemini chatbot API, formerly **BARD**.\n\n## Installation\n```bash\n $ pip3 install --upgrade GoogleBard1\n```\n\n## Authentication\nGo to https://bard.google.com/\n\n- F12 for console\n- Copy the values\n  - Session: Go to Application \u2192 Cookies \u2192 `__Secure-1PSID` and `__Secure-1PSIDTS`. Copy the value of those cookie.\n\n## Usage\n\n```bash\n$ python3 -m Bard -h\nusage: Bard.py [-h] --session SESSION --session_ts SESSION_TS\n\noptions:\n  -h, --help            show this help message and exit\n  --session SESSION     __Secure-1PSID cookie\n  --session_ts SESSION_TS\n                        __secure_1psidts cookie.\n```\n\n### Quick mode\n```\n$ export BARD_QUICK=\"true\"\n$ export BARD__Secure_1PSID=\"<__Secure-1PSID>\"\n$ export BARD__Secure_1PSIDTS=\"<__Secure-1PSIDTS>\"\n$ python3 -m Bard\n```\nEnvironment variables can be placed in .zshrc.\n\nExample bash shortcut:\n```bash\n# USAGE1: bard QUESTION\n# USAGE2: echo \"QUESTION\" | bard\nbard () {\n\texport BARD_QUICK=true\n\texport BARD__Secure_1PSID=<__Secure-1PSID>\n\texport BARD__Secure_1PSIDTS=<__Secure-1PSIDTS>\n\tpython3 -m Bard \"${@:-$(</dev/stdin)}\" | tail -n+7\n}\n```\n\n### Implementation:\n```python\nfrom os import environ\nfrom Bard import Chatbot\n\nSecure_1PSID = environ.get(\"BARD__Secure_1PSID\")\nSecure_1PSIDTS = environ.get(\"BARD__Secure_1PSIDTS\")\nchatbot = Chatbot(Secure_1PSID, Secure_1PSIDTS)\n\nanswer = chatbot.ask(\"Hello, how are you?\")\n\nprint(answer['content']\n```\n\n### Async Implementation:\n```python\nimport asyncio\nfrom os import environ\nfrom Bard import AsyncChatbot\n\nSecure_1PSID = environ.get(\"BARD__Secure_1PSID\")\nSecure_1PSIDTS = environ.get(\"BARD__Secure_1PSIDTS\")\n\nasync def main():\n    chatbot = await AsyncChatbot.create(Secure_1PSID, Secure_1PSIDTS)\n    response = await chatbot.ask(\"Hello, how are you?\")\n    print(response['content'])\n\nasyncio.run(main())\n```\n\n> [!IMPORTANT]\n> The cookies expire after a short period; ensure you update them as frequent as possible.\n\n## [Developer Documentation](https://github.com/Simatwa/Bard/blob/main/DOCUMENTATION.md)\n\nCredits:\n- [discordtehe](https://github.com/discordtehe) - Derivative of his original reverse engineering\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Reverse engineering of Google's Bard chatbot",
    "version": "2.1.4",
    "project_urls": {
        "Bug Report": "https://github.com/Simatwa/Bard/issues/new",
        "Homepage": "https://github.com/Simatwa/Bard"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "60862e6b5efe1d813404dc247fc92a799a1fb261a21e298f009797bb9dfe1b58",
                "md5": "b42e7ff5f7fb7e07fd0facf904fb3d5f",
                "sha256": "7afb22c21b9861e66792855186b77c1107afa2f7167f1734d4db62602fa97644"
            },
            "downloads": -1,
            "filename": "GoogleBard1-2.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b42e7ff5f7fb7e07fd0facf904fb3d5f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6763,
            "upload_time": "2024-03-02T10:46:13",
            "upload_time_iso_8601": "2024-03-02T10:46:13.163514Z",
            "url": "https://files.pythonhosted.org/packages/60/86/2e6b5efe1d813404dc247fc92a799a1fb261a21e298f009797bb9dfe1b58/GoogleBard1-2.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "74094f6616798faf77d175116c693fe50de03869165ce6ed566f642f0270b09a",
                "md5": "6affae5ca408df27f7970309e8bd150c",
                "sha256": "f21a0960cee121a7e5d1c13e444d3bef85bc585af25f0aa3433c76640a668b9b"
            },
            "downloads": -1,
            "filename": "GoogleBard1-2.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "6affae5ca408df27f7970309e8bd150c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6512,
            "upload_time": "2024-03-02T10:46:17",
            "upload_time_iso_8601": "2024-03-02T10:46:17.111668Z",
            "url": "https://files.pythonhosted.org/packages/74/09/4f6616798faf77d175116c693fe50de03869165ce6ed566f642f0270b09a/GoogleBard1-2.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-02 10:46:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Simatwa",
    "github_project": "Bard",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "googlebard1"
}
        
Elapsed time: 0.32938s