From aa9985c6f5c42630236e7d2fdea3b42bed39dad7 Mon Sep 17 00:00:00 2001 From: st1vms <96783398+st1vms@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:15:31 +0100 Subject: [PATCH] Projec Rename! Needs repo rename! --- README.md | 28 +++++++++++++------------- claude2_api/__init__.py | 8 ++++---- claude_api/__init__.py | 20 ++++++++++++++++++ {claude2_api => claude_api}/client.py | 0 {claude2_api => claude_api}/errors.py | 0 {claude2_api => claude_api}/session.py | 0 setup.py | 12 +++++------ 7 files changed, 44 insertions(+), 24 deletions(-) create mode 100644 claude_api/__init__.py rename {claude2_api => claude_api}/client.py (100%) rename {claude2_api => claude_api}/errors.py (100%) rename {claude2_api => claude_api}/session.py (100%) diff --git a/README.md b/README.md index 39c203b..e769c6c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# unofficial-claude2-api +# unofficial-claude-api ## Table of Contents @@ -42,13 +42,13 @@ and more. ## How to install ```shell -pip install unofficial-claude2-api +pip install unofficial-claude-api ``` ## Uninstallation ```shell -pip uninstall unofficial-claude2-api +pip uninstall unofficial-claude-api ``` ## Requirements @@ -65,15 +65,15 @@ pip uninstall unofficial-claude2-api ```python from sys import exit as sys_exit -from claude2_api.client import ( +from claude_api.client import ( ClaudeAPIClient, SendMessageResponse, ) -from claude2_api.session import SessionData, get_session_data -from claude2_api.errors import ClaudeAPIError, MessageRateLimitError, OverloadError +from claude_api.session import SessionData, get_session_data +from claude_api.errors import ClaudeAPIError, MessageRateLimitError, OverloadError # Wildcard import will also work the same as above -# from claude2_api import * +# from claude_api import * # List of attachments filepaths, up to 5, max 10 MB each FILEPATH_LIST = [ @@ -192,7 +192,7 @@ If for whatever reason you'd like to avoid auto session gathering using selenium you just need to manually create a `SessionData` class for `ClaudeAPIClient` constructor, like so... ```python -from claude2_api.session import SessionData +from claude_api.session import SessionData cookie_header_value = "The entire Cookie header value string when you visit https://claude.ai/chats" user_agent = "User agent to use, required" @@ -215,8 +215,8 @@ __________ If you'd like to set an HTTP proxy for all requests, follow this example: ```py -from claude2_api.client import HTTPProxy, ClaudeAPIClient -from claude2_api.session import SessionData +from claude_api.client import HTTPProxy, ClaudeAPIClient +from claude_api.session import SessionData # Create HTTPProxy instance http_proxy = HTTPProxy( @@ -236,8 +236,8 @@ client = ClaudeAPIClient(session, proxy=http_proxy) If you want to opt for SOCKS proxies instead, the procedure is the same, but you need to import the `SOCKSProxy` class instead, configuring it with the version number. ```py -from claude2_api.client import SOCKSProxy, ClaudeAPIClient -from claude2_api.session import SessionData +from claude_api.client import SOCKSProxy, ClaudeAPIClient +from claude_api.session import SessionData # Create SOCKSProxy instance socks_proxy = SOCKSProxy( @@ -259,8 +259,8 @@ __________ In case you have accounts that are unable to migrate to latest model, you can override the `model_name` string parameter of `ClaudeAPIClient` constructor. ```py -from claude2_api.client import ClaudeAPIClient -from claude2_api.session import SessionData +from claude_api.client import ClaudeAPIClient +from claude_api.session import SessionData session = SessionData(...) diff --git a/claude2_api/__init__.py b/claude2_api/__init__.py index f2b06a8..a6391e3 100644 --- a/claude2_api/__init__.py +++ b/claude2_api/__init__.py @@ -1,11 +1,11 @@ -"""unofficial-claude2-api""" -from .client import ( +"""Backward compatibility import (Before dev-0.3.1)""" +from claude_api.client import ( ClaudeAPIClient, SendMessageResponse, HTTPProxy, ) -from .session import SessionData, get_session_data -from .errors import ClaudeAPIError, MessageRateLimitError, OverloadError +from claude_api.session import SessionData, get_session_data +from claude_api.errors import ClaudeAPIError, MessageRateLimitError, OverloadError __all__ = [ diff --git a/claude_api/__init__.py b/claude_api/__init__.py new file mode 100644 index 0000000..2e6d928 --- /dev/null +++ b/claude_api/__init__.py @@ -0,0 +1,20 @@ +"""unofficial-claude-api""" +from .client import ( + ClaudeAPIClient, + SendMessageResponse, + HTTPProxy, +) +from .session import SessionData, get_session_data +from .errors import ClaudeAPIError, MessageRateLimitError, OverloadError + + +__all__ = [ + "ClaudeAPIClient", + "SendMessageResponse", + "HTTPProxy", + "SessionData", + "get_session_data", + "MessageRateLimitError", + "ClaudeAPIError", + "OverloadError", +] diff --git a/claude2_api/client.py b/claude_api/client.py similarity index 100% rename from claude2_api/client.py rename to claude_api/client.py diff --git a/claude2_api/errors.py b/claude_api/errors.py similarity index 100% rename from claude2_api/errors.py rename to claude_api/errors.py diff --git a/claude2_api/session.py b/claude_api/session.py similarity index 100% rename from claude2_api/session.py rename to claude_api/session.py diff --git a/setup.py b/setup.py index 2fd4d43..4a8d4f3 100644 --- a/setup.py +++ b/setup.py @@ -2,9 +2,9 @@ from os.path import dirname, join, abspath from setuptools import setup, find_packages -__DESCRIPTION = """Unofficial Claude2 API supporting direct HTTP chat creation/deletion/retrieval, \ -multiple message attachments, proxies and auto session gathering using Firefox with geckodriver. \ -""" +__DESCRIPTION = """This unofficial Python API provides access to \ +the conversational capabilities of Anthropic's Claude AI \ +through a simple chat messaging interface.""" with open( join(abspath(dirname(__file__)), "README.md"), @@ -15,14 +15,14 @@ __LONG_DESCRIPTION = fp.read().lstrip().rstrip() setup( - name="unofficial-claude2-api", - version="0.3.0", + name="unofficial-claude-api", + version="0.3.1", author="st1vms", author_email="stefano.maria.salvatore@gmail.com", description=__DESCRIPTION, long_description=__LONG_DESCRIPTION, long_description_content_type="text/markdown", - url="https://github.com/st1vms/unofficial-claude2-api", + url="https://github.com/st1vms/unofficial-claude-api", packages=find_packages(), classifiers=[ "Programming Language :: Python :: 3.10",