From c6ce0a6f81f071b3e95957450a7403cb216865dd Mon Sep 17 00:00:00 2001 From: jahwag <540380+jahwag@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:32:06 +0200 Subject: [PATCH] Update Claude.ai API Base URL to Resolve 403 Errors (#36) This addresses a 403 Forbidden error encountered when uploading certain files. The issue is likely due to the new base URL hitting a different firewall than the previous configuration. This update changes the API base URL to ensure compatibility and resolve the upload issue. --- .gitignore | 4 ++- pyproject.toml | 31 ++++++++++++---------- requirements.txt | 6 ++--- src/claudesync/providers/base_claude_ai.py | 2 +- src/claudesync/providers/claude_ai_curl.py | 2 ++ tests/providers/test_claude_ai_curl.py | 2 +- 6 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index bd9442f..421f4ab 100644 --- a/.gitignore +++ b/.gitignore @@ -170,4 +170,6 @@ claude.sync config.json claudesync.log claude_chats -some_value \ No newline at end of file +some_value + +ROADMAP.md \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 96e4967..2e39124 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,6 @@ -[build-system] -requires = ["setuptools>=42", "wheel"] -build-backend = "setuptools.build_meta" - [project] name = "claudesync" -version = "0.4.6" +version = "0.4.7" authors = [ {name = "Jahziah Wagner", email = "jahziah.wagner+pypi@gmail.com"}, ] @@ -18,15 +14,12 @@ classifiers = [ "Operating System :: OS Independent", ] dependencies = [ - "Click", - "requests", - "pathspec", - "crontab", - "setuptools", - "pytest", - "pytest-cov", - "click_completion", - "tqdm", + "Click>=8.1.7", + "requests>=2.32.3", + "pathspec>=0.12.1", + "crontab>=1.0.1", + "click_completion>=0.5.2", + "tqdm>=4.66.4", ] keywords = [ "sync", @@ -47,6 +40,12 @@ keywords = [ "version control" ] +[project.optional-dependencies] +test = [ + "pytest>=8.2.2", + "pytest-cov>=5.0.0", +] + [project.urls] "Homepage" = "https://github.com/jahwag/claudesync" "Bug Tracker" = "https://github.com/jahwag/claudesync/issues" @@ -54,6 +53,10 @@ keywords = [ [project.scripts] claudesync = "claudesync.cli.main:cli" +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + [tool.setuptools.packages.find] where = ["src"] include = ["claudesync*"] diff --git a/requirements.txt b/requirements.txt index af10441..b5f5e25 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,6 @@ Click>=8.1.7 requests>=2.32.3 pathspec>=0.12.1 crontab>=1.0.1 -setuptools>=65.5.1 -pytest>=8.2.2 -pytest-cov>=5.0.0 click_completion>=0.5.2 -tqdm>=4.66.4 \ No newline at end of file +tqdm>=4.66.4 +pytest-cov>=5.0.0 \ No newline at end of file diff --git a/src/claudesync/providers/base_claude_ai.py b/src/claudesync/providers/base_claude_ai.py index 8078554..b1b1c89 100644 --- a/src/claudesync/providers/base_claude_ai.py +++ b/src/claudesync/providers/base_claude_ai.py @@ -35,7 +35,7 @@ def _get_session_key_expiry(): class BaseClaudeAIProvider(BaseProvider): - BASE_URL = "https://claude.ai/api" + BASE_URL = "https://api.claude.ai/api" def __init__(self, session_key=None, session_key_expiry=None): self.config = ConfigManager() diff --git a/src/claudesync/providers/claude_ai_curl.py b/src/claudesync/providers/claude_ai_curl.py index 6a29845..c5a3a03 100644 --- a/src/claudesync/providers/claude_ai_curl.py +++ b/src/claudesync/providers/claude_ai_curl.py @@ -19,6 +19,8 @@ def _make_request(self, method, endpoint, data=None): command = self._build_curl_command(method, url, headers, data) + self.logger.debug(f"Executing command: {' '.join(command)}") + try: result = subprocess.run( command, capture_output=True, text=True, check=True, encoding="utf-8" diff --git a/tests/providers/test_claude_ai_curl.py b/tests/providers/test_claude_ai_curl.py index 63a2c2a..4484850 100644 --- a/tests/providers/test_claude_ai_curl.py +++ b/tests/providers/test_claude_ai_curl.py @@ -31,7 +31,7 @@ def test_make_request_success(self, mock_run, mock_get_session_key): mock_run.assert_called_once() args, kwargs = mock_run.call_args self.assertIn("curl", args[0]) - self.assertIn("https://claude.ai/api/test", args[0]) + self.assertIn("https://api.claude.ai/api/test", args[0]) self.assertIn("--compressed", args[0]) self.assertIn("-s", args[0]) self.assertIn("-S", args[0])