ChatGPTAutomation


NameChatGPTAutomation JSON
Version 0.6.1 PyPI version JSON
download
home_pagehttps://github.com/iamseyedalipro/ChatGPTAutomation
SummaryA Python package for automating interactions with ChatGPT using Selenium. Chatgpt automation without api. Chatgptautomation
upload_time2024-04-29 07:49:40
maintainerNone
docs_urlNone
authorSeyed Ali Hosseini
requires_python>=3.8
licenseNone
keywords chatgpt automation selenium openai chatbot test automation webdriver gpt-3 automation gpt-4 automation file upload automation chat history retrieval login automation developers qa testers automation engineers pytest robot framework python library automation library best chatgpt automation tool selenium chatgpt integration
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# ChatGPTAutomation πŸ€–πŸ’»πŸ§ 

## Description
ChatGPTAutomation is a Python package that automates interactions with ChatGPT using Selenium, streamlining the process for developers and testers. πŸš€

## Features
- Automated messaging to ChatGPT. πŸ“©
- File upload support. πŸ“
- ChatGPT conversation retrieval and storage. πŸ—‚οΈ
- Customizable WebDriver for browser management. 🌐
- Configurable delays for various operations. ⏲️

## Installation
Install with:
```bash
pip install ChatGPTAutomation
```

## Usage

### Chrome WebDriver Download

- **Latest Chrome Version**: Download [here](https://googlechromelabs.github.io/chrome-for-testing/).
- **Older Chrome Versions**: Find compatible drivers [here](https://chromedriver.chromium.org/downloads).

### Setup

#### Automatic setup (without paths):
```python
from chatgpt_automation.chatgpt_automation import ChatGPTAutomation

chat_bot = ChatGPTAutomation(
    username="<your username here>", # Optional
    password="<your password here>"  # Optional
)
```

#### Manual setup (with paths):
```python
from chatgpt_automation.chatgpt_automation import ChatGPTAutomation

chat_bot = ChatGPTAutomation(
    chrome_path="path/to/chrome.exe", 
    chrome_driver_path="path/to/chromedriver.exe",
    username="<your username here>", # Optional
    password="<your password here>"  # Optional
)

# Send prompt
chat_bot.send_prompt_to_chatgpt("Hello, ChatGPT!")

# Save conversation
chat_bot.save_conversation("conversation.txt")
```

### File upload
```python
chat_bot.upload_file_for_prompt("test_file.txt")
chat_bot.send_prompt_to_chatgpt("Explain this file?")
```

### Check response status
```python
if chat_bot.check_response_status():
    print("Response ready.")
else:
    print("Response issue.")
```

### Get last response
```python
chat_bot.send_prompt_to_chatgpt("Hello, ChatGPT!")
response = chat_bot.return_last_response()
```

### Switch models
```python
chat_bot.switch_model(4)
```

### Login check
```python
if chat_bot.check_login_page():
    chat_bot.login()
```

### Login with Gmail

The `gmail_login_setup` function in `ChatGPTAutomation` allows you to automate the process of logging into ChatGPT using a Gmail account.

#### Automatic Gmail Login
To automatically log in using Gmail credentials, you can use the `gmail_login_setup` method. This method requires the email and password to be set either as parameters or within the class instance.

```python
# Automatic login using stored credentials
chat_bot.gmail_login_setup()

# Alternatively, specify the credentials directly
chat_bot.gmail_login_setup(email="your.email@gmail.com", password="yourpassword")
```

#### Login with google
if you logged in to the google account but logged out from openai account can use this function for login with that gmail
```python
chat_bot.login_using_gamil("iamseyedalipro@gmail.com") #this is optional you can set the email first of setup on username field
```



---
## Delay Configurations

The `ChatGPTAutomation` class includes configurable delays for various operations, defined in the `DelayTimes` class:

- `CONSTRUCTOR_DELAY`: Time to wait for initialization.
- `SEND_PROMPT_DELAY`: Delay after sending a prompt to ChatGPT.
- `UPLOAD_FILE_DELAY`: Delay following a file upload.
- `RETURN_LAST_RESPONSE_DELAY`: Wait time to fetch the last response.
- `OPEN_NEW_CHAT_DELAY`: Delay in opening a new chat session.
- `DEL_CURRENT_CHAT_OPEN_MENU_DELAY`: Wait time before deleting current chat.
- `DEL_CURRENT_CHAT_AFTER_DELETE_DELAY`: Delay after deleting current chat.
- `DEL_CURRENT_CHAT_BEFORE_OPEN_NEW_CHAT_DELAY`: Wait time before opening new chat after deletion.
- `CHECK_RESPONSE_STATUS_DELAY`: Interval to check response status.

These delays are crucial for the stability and reliability of automated interactions with ChatGPT.


## Customizing Delay Times

The `ChatGPTAutomation` class comes with default delay settings for various operations, suitable for most use cases. However, you might find the need to adjust these delay times based on your network speed, system performance, or specific use case requirements. Here’s how you can customize these delay times.

### Accessing Delay Times

The delay settings are part of the `DelayTimes` inner class in `ChatGPTAutomation`. They are defined as class variables and can be accessed directly using the class name.

### Changing Delay Times

To change the delay times, access the respective variable in the `DelayTimes` class and set it to your desired value (in seconds). Here’s an example of how to do this:

```python
from chatgpt_automation.chatgpt_automation import ChatGPTAutomation

# Access and modify delay times
ChatGPTAutomation.DelayTimes.CONSTRUCTOR_DELAY = 10  # Set constructor delay to 10 seconds
ChatGPTAutomation.DelayTimes.SEND_PROMPT_DELAY = 25  # Set send prompt delay to 25 seconds
# ... similarly for other delay times

# Initialize ChatGPTAutomation with customized delay times
chat_bot = ChatGPTAutomation(
    username="<your username here>",
    password="<your password here>"
)

# The rest of your code...
```

### Recommended Practices

- **Testing**: When changing delay times, it's recommended to test the interaction with ChatGPT to ensure that the new settings work well in your environment.
- **Incremental Adjustments**: Make incremental adjustments and test each change rather than making large changes all at once.
- **Network Speed Consideration**: If you are working with a slow network connection, consider increasing the delay times to allow for longer response times from ChatGPT.

By following these steps and recommendations, you can fine-tune the behavior of the `ChatGPTAutomation` class to best fit your automation needs.

---

## Requirements
- Python 3.8+
- Selenium==4.9.0
- See `requirements.txt` for more.

## To-Do List

### Sign up:
- βœ… User login
- ⬜️ Sign up via email address

### Conversation Management:
- βœ… Create new conversation
- βœ… Get message list in a conversation
- βœ… Delete a conversation
- ⬜️ Edit Conversation Name
- ⬜️ Subscribe for realtime message
- ⬜️ Handle Random message such as popup, hints, and login attempts

### Advanced Features:
- βœ… Support for uploading files
- ⬜️ Support ChatGPT with internet
- ⬜️ Using GPTs
- ⬜️ API

### User Account Handling:
- βœ… Switch Between ChatGPT 3.5 and 4
- ⬜️ Fetch user detail like email and plan type
- ⬜️ Set custom instructions for more personalized conversations

### Browser:
- ⬜️ Headless Browser

## License
MIT License - see [LICENCE.md](LICENCE.md).

## Contact
Seyed Ali Hosseini πŸ§‘β€πŸ’» - iamseyedalipro@gmail.com πŸ“§.

## Acknowledgements
- Thanks to OpenAI and Selenium. πŸ™πŸ‘¨β€πŸ’»

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iamseyedalipro/ChatGPTAutomation",
    "name": "ChatGPTAutomation",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "chatgpt automation selenium openai chatbot test automation webdriver gpt-3 automation gpt-4 automation file upload automation chat history retrieval login automation developers QA testers automation engineers pytest robot framework python library automation library best chatgpt automation tool selenium chatgpt integration",
    "author": "Seyed Ali Hosseini",
    "author_email": "iamseyedalipro@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e6/1d/e573692ad383f75694449100d0bd2f573b1ef35d2ad70b54f0a9cdc8b4ae/chatgptautomation-0.6.1.tar.gz",
    "platform": null,
    "description": "\r\n# ChatGPTAutomation \ud83e\udd16\ud83d\udcbb\ud83e\udde0\r\n\r\n## Description\r\nChatGPTAutomation is a Python package that automates interactions with ChatGPT using Selenium, streamlining the process for developers and testers. \ud83d\ude80\r\n\r\n## Features\r\n- Automated messaging to ChatGPT. \ud83d\udce9\r\n- File upload support. \ud83d\udcc1\r\n- ChatGPT conversation retrieval and storage. \ud83d\uddc2\ufe0f\r\n- Customizable WebDriver for browser management. \ud83c\udf10\r\n- Configurable delays for various operations. \u23f2\ufe0f\r\n\r\n## Installation\r\nInstall with:\r\n```bash\r\npip install ChatGPTAutomation\r\n```\r\n\r\n## Usage\r\n\r\n### Chrome WebDriver Download\r\n\r\n- **Latest Chrome Version**: Download [here](https://googlechromelabs.github.io/chrome-for-testing/).\r\n- **Older Chrome Versions**: Find compatible drivers [here](https://chromedriver.chromium.org/downloads).\r\n\r\n### Setup\r\n\r\n#### Automatic setup (without paths):\r\n```python\r\nfrom chatgpt_automation.chatgpt_automation import ChatGPTAutomation\r\n\r\nchat_bot = ChatGPTAutomation(\r\n    username=\"<your username here>\", # Optional\r\n    password=\"<your password here>\"  # Optional\r\n)\r\n```\r\n\r\n#### Manual setup (with paths):\r\n```python\r\nfrom chatgpt_automation.chatgpt_automation import ChatGPTAutomation\r\n\r\nchat_bot = ChatGPTAutomation(\r\n    chrome_path=\"path/to/chrome.exe\", \r\n    chrome_driver_path=\"path/to/chromedriver.exe\",\r\n    username=\"<your username here>\", # Optional\r\n    password=\"<your password here>\"  # Optional\r\n)\r\n\r\n# Send prompt\r\nchat_bot.send_prompt_to_chatgpt(\"Hello, ChatGPT!\")\r\n\r\n# Save conversation\r\nchat_bot.save_conversation(\"conversation.txt\")\r\n```\r\n\r\n### File upload\r\n```python\r\nchat_bot.upload_file_for_prompt(\"test_file.txt\")\r\nchat_bot.send_prompt_to_chatgpt(\"Explain this file?\")\r\n```\r\n\r\n### Check response status\r\n```python\r\nif chat_bot.check_response_status():\r\n    print(\"Response ready.\")\r\nelse:\r\n    print(\"Response issue.\")\r\n```\r\n\r\n### Get last response\r\n```python\r\nchat_bot.send_prompt_to_chatgpt(\"Hello, ChatGPT!\")\r\nresponse = chat_bot.return_last_response()\r\n```\r\n\r\n### Switch models\r\n```python\r\nchat_bot.switch_model(4)\r\n```\r\n\r\n### Login check\r\n```python\r\nif chat_bot.check_login_page():\r\n    chat_bot.login()\r\n```\r\n\r\n### Login with Gmail\r\n\r\nThe `gmail_login_setup` function in `ChatGPTAutomation` allows you to automate the process of logging into ChatGPT using a Gmail account.\r\n\r\n#### Automatic Gmail Login\r\nTo automatically log in using Gmail credentials, you can use the `gmail_login_setup` method. This method requires the email and password to be set either as parameters or within the class instance.\r\n\r\n```python\r\n# Automatic login using stored credentials\r\nchat_bot.gmail_login_setup()\r\n\r\n# Alternatively, specify the credentials directly\r\nchat_bot.gmail_login_setup(email=\"your.email@gmail.com\", password=\"yourpassword\")\r\n```\r\n\r\n#### Login with google\r\nif you logged in to the google account but logged out from openai account can use this function for login with that gmail\r\n```python\r\nchat_bot.login_using_gamil(\"iamseyedalipro@gmail.com\") #this is optional you can set the email first of setup on username field\r\n```\r\n\r\n\r\n\r\n---\r\n## Delay Configurations\r\n\r\nThe `ChatGPTAutomation` class includes configurable delays for various operations, defined in the `DelayTimes` class:\r\n\r\n- `CONSTRUCTOR_DELAY`: Time to wait for initialization.\r\n- `SEND_PROMPT_DELAY`: Delay after sending a prompt to ChatGPT.\r\n- `UPLOAD_FILE_DELAY`: Delay following a file upload.\r\n- `RETURN_LAST_RESPONSE_DELAY`: Wait time to fetch the last response.\r\n- `OPEN_NEW_CHAT_DELAY`: Delay in opening a new chat session.\r\n- `DEL_CURRENT_CHAT_OPEN_MENU_DELAY`: Wait time before deleting current chat.\r\n- `DEL_CURRENT_CHAT_AFTER_DELETE_DELAY`: Delay after deleting current chat.\r\n- `DEL_CURRENT_CHAT_BEFORE_OPEN_NEW_CHAT_DELAY`: Wait time before opening new chat after deletion.\r\n- `CHECK_RESPONSE_STATUS_DELAY`: Interval to check response status.\r\n\r\nThese delays are crucial for the stability and reliability of automated interactions with ChatGPT.\r\n\r\n\r\n## Customizing Delay Times\r\n\r\nThe `ChatGPTAutomation` class comes with default delay settings for various operations, suitable for most use cases. However, you might find the need to adjust these delay times based on your network speed, system performance, or specific use case requirements. Here\u2019s how you can customize these delay times.\r\n\r\n### Accessing Delay Times\r\n\r\nThe delay settings are part of the `DelayTimes` inner class in `ChatGPTAutomation`. They are defined as class variables and can be accessed directly using the class name.\r\n\r\n### Changing Delay Times\r\n\r\nTo change the delay times, access the respective variable in the `DelayTimes` class and set it to your desired value (in seconds). Here\u2019s an example of how to do this:\r\n\r\n```python\r\nfrom chatgpt_automation.chatgpt_automation import ChatGPTAutomation\r\n\r\n# Access and modify delay times\r\nChatGPTAutomation.DelayTimes.CONSTRUCTOR_DELAY = 10  # Set constructor delay to 10 seconds\r\nChatGPTAutomation.DelayTimes.SEND_PROMPT_DELAY = 25  # Set send prompt delay to 25 seconds\r\n# ... similarly for other delay times\r\n\r\n# Initialize ChatGPTAutomation with customized delay times\r\nchat_bot = ChatGPTAutomation(\r\n    username=\"<your username here>\",\r\n    password=\"<your password here>\"\r\n)\r\n\r\n# The rest of your code...\r\n```\r\n\r\n### Recommended Practices\r\n\r\n- **Testing**: When changing delay times, it's recommended to test the interaction with ChatGPT to ensure that the new settings work well in your environment.\r\n- **Incremental Adjustments**: Make incremental adjustments and test each change rather than making large changes all at once.\r\n- **Network Speed Consideration**: If you are working with a slow network connection, consider increasing the delay times to allow for longer response times from ChatGPT.\r\n\r\nBy following these steps and recommendations, you can fine-tune the behavior of the `ChatGPTAutomation` class to best fit your automation needs.\r\n\r\n---\r\n\r\n## Requirements\r\n- Python 3.8+\r\n- Selenium==4.9.0\r\n- See `requirements.txt` for more.\r\n\r\n## To-Do List\r\n\r\n### Sign up:\r\n- \u2705 User login\r\n- \u2b1c\ufe0f Sign up via email address\r\n\r\n### Conversation Management:\r\n- \u2705 Create new conversation\r\n- \u2705 Get message list in a conversation\r\n- \u2705 Delete a conversation\r\n- \u2b1c\ufe0f Edit Conversation Name\r\n- \u2b1c\ufe0f Subscribe for realtime message\r\n- \u2b1c\ufe0f Handle Random message such as popup, hints, and login attempts\r\n\r\n### Advanced Features:\r\n- \u2705 Support for uploading files\r\n- \u2b1c\ufe0f Support ChatGPT with internet\r\n- \u2b1c\ufe0f Using GPTs\r\n- \u2b1c\ufe0f API\r\n\r\n### User Account Handling:\r\n- \u2705 Switch Between ChatGPT 3.5 and 4\r\n- \u2b1c\ufe0f Fetch user detail like email and plan type\r\n- \u2b1c\ufe0f Set custom instructions for more personalized conversations\r\n\r\n### Browser:\r\n- \u2b1c\ufe0f Headless Browser\r\n\r\n## License\r\nMIT License - see [LICENCE.md](LICENCE.md).\r\n\r\n## Contact\r\nSeyed Ali Hosseini \ud83e\uddd1\u200d\ud83d\udcbb - iamseyedalipro@gmail.com \ud83d\udce7.\r\n\r\n## Acknowledgements\r\n- Thanks to OpenAI and Selenium. \ud83d\ude4f\ud83d\udc68\u200d\ud83d\udcbb\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python package for automating interactions with ChatGPT using Selenium. Chatgpt automation without api. Chatgptautomation",
    "version": "0.6.1",
    "project_urls": {
        "Homepage": "https://github.com/iamseyedalipro/ChatGPTAutomation"
    },
    "split_keywords": [
        "chatgpt",
        "automation",
        "selenium",
        "openai",
        "chatbot",
        "test",
        "automation",
        "webdriver",
        "gpt-3",
        "automation",
        "gpt-4",
        "automation",
        "file",
        "upload",
        "automation",
        "chat",
        "history",
        "retrieval",
        "login",
        "automation",
        "developers",
        "qa",
        "testers",
        "automation",
        "engineers",
        "pytest",
        "robot",
        "framework",
        "python",
        "library",
        "automation",
        "library",
        "best",
        "chatgpt",
        "automation",
        "tool",
        "selenium",
        "chatgpt",
        "integration"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "02ce874f28e644788f1ef02901a52ccff5b94d218e17221706f364c238f4e990",
                "md5": "f0a77dae9547e4b2cd238f59be6f4743",
                "sha256": "26b7d46cb9416b6acd85617fe867c509596a4350f09dd9247556206637fff4f3"
            },
            "downloads": -1,
            "filename": "ChatGPTAutomation-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f0a77dae9547e4b2cd238f59be6f4743",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 18316,
            "upload_time": "2024-04-29T07:49:37",
            "upload_time_iso_8601": "2024-04-29T07:49:37.929595Z",
            "url": "https://files.pythonhosted.org/packages/02/ce/874f28e644788f1ef02901a52ccff5b94d218e17221706f364c238f4e990/ChatGPTAutomation-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e61de573692ad383f75694449100d0bd2f573b1ef35d2ad70b54f0a9cdc8b4ae",
                "md5": "3efaa62e49d1a3d7b1d4ac09135c9990",
                "sha256": "fc26293d3548efee1c73f8c5664b4b304d82684a15d1353ed02d1712ab2bd939"
            },
            "downloads": -1,
            "filename": "chatgptautomation-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3efaa62e49d1a3d7b1d4ac09135c9990",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 17389,
            "upload_time": "2024-04-29T07:49:40",
            "upload_time_iso_8601": "2024-04-29T07:49:40.154565Z",
            "url": "https://files.pythonhosted.org/packages/e6/1d/e573692ad383f75694449100d0bd2f573b1ef35d2ad70b54f0a9cdc8b4ae/chatgptautomation-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-29 07:49:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iamseyedalipro",
    "github_project": "ChatGPTAutomation",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "chatgptautomation"
}
        
Elapsed time: 0.25596s