I am trying to change proxies mid script.
I’ve tried running the script as a subprocess with different arguments but it seems to bug out after a few runs (process.kill() and make sure port is free before launching another, still bugs out for some reason).
so instead, I am trying to locally change the proxy mid-run, hopefully, one of you will be able to help me since I am really out of ideas now haha.
flow.request.upstream_proxy = ('us.smartproxy.com', '10015')
server_connection_already_open = flow.server_conn.timestamp_start is not None
if server_connection_already_open:
# server_conn already refers to an existing connection (which cannot be modified),
# so we need to replace it with a new server connection object.
flow.server_conn = Server(address=flow.server_conn.address)
flow.server_conn.via = ServerSpec(upstream_proxy)
I tried using this, seems like it does not work (checking IP with whoer).