Add proxy setting to the Claude client, the user may has no right to connect claude.ai direct directly, but can do by a proxy. So this PR add an optional parameter to init funtion of Client class, which expect a dict to specify proxies for all protocals. The format of proxy parametr is same as requests lib.
Usage
import json
import os
from claude_api import Client
cookie = os.environ.get('cookie')
if not cookie:
raise Exception('Please set the cookie environment variable')
print(f'cookie:{cookie}')
claude_api = Client(cookie, proxies={
'http': 'http://proxy.example.com:8080',
'https': 'http://secureproxy.example.com:8090',
})
prompt = "Please give me an interesting python code snippet within 5 lines."
conversation = claude_api.create_new_chat()
conversation_id = conversation['uuid']
response = claude_api.send_message(prompt, conversation_id)
print(response)
Purpose
Add proxy setting to the Claude client, the user may has no right to connect claude.ai direct directly, but can do by a proxy. So this PR add an optional parameter to init funtion of Client class, which expect a dict to specify proxies for all protocals. The format of proxy parametr is same as requests lib.
Usage