claude-api-py
claude-api-py copied to clipboard
HTTP Error 403: Forbidden
I'm trying to run this code:
from claude import claude_client
from claude import claude_wrapper
SESSION_KEY = <MY_SESSION_KEY>
client = claude_client.ClaudeClient(SESSION_KEY)
organizations = client.get_organizations()
organizations
but I get this:
WARNING:root:Failed response object: Response(ok=False, data=b'', status_code=None, error='HTTP Error 403: Forbidden')
None
I don't really understand what the problem is.
Could you dump the logs, try a different session key, or try a different account?
I have the same problem. [17-Mar-24 18:10:48:root:WARNING][claude_client.py:304 - get_organizations() ] Failed response object: Response(ok=False, data=b'', status_code=None, error='HTTP Error 403: Forbidden') None
same case here
same error that happened since last Friday
same, probably some additional headers or security was added recently.
@jensen1207 @gerkim62 @sakurakoujirabbit @codemurt
The problem is anthropic uses cloudflare cookies to prevent bots. These cookies refresh periodically, so this probably isn't a permanent solution. The "real" best way to solve this would be to completely mock the browser or find some way to bypass cloudflare cookies. The former is too heavyweight and the latter might be difficult.
Since this is also kind of against their TOS, I don't think I can comment more.