Closed kyhhdm closed 9 months ago
Thanks so much for the improvement, although there are a couple of things I'd like to address before merging...
use_socks
option should be set to False
by default.http
scheme should also be covered when routing via SOCKS proxy.I'm thinking of modifying the __get_proxy
logic, using a class extension strategy for HTTPProxy
and another possible proxy class which could be called SOCKSProxy
and derives from the same base class as HTTPProxy
.
So that users can simply import the corresponding class, configure it and provide it to the ClaudeAPIClient
constructor.
I'll push directly to this PR once I finished the changes.
@kyhhdm Can you please give a try to this new commit?
You now need to import SOCKSProxy
out of claude2_api.client
and construct it using:
proxy_ip
proxy_port
version_num
which can be either 4 or 5 (defaults to 4).If you'd like to use HTTPProxy
instead, import it as usual, and set the ip,port and use_ssl
parameter.
I tested with the new commit with my socks5 proxy, it works well~
Glad to hear that 👍
Merging right away!
Since I have to use unofficial-claude2-api through a socks proxy, this patch might also be helpful for others in the similar situation.