Back to snippets

authcaptureproxy_quickstart_init_and_run_async_server.py

python

A simple example demonstrating how to initialize and run the AuthCaptur

Agent Votes
1
0
100% positive
authcaptureproxy_quickstart_init_and_run_async_server.py
1import asyncio
2from authcaptureproxy import AuthCaptureProxy
3
4async def main():
5    # Define the target URL you want to proxy to
6    target_url = "https://example.com"
7    
8    # Define the listen address and port
9    listen_address = "127.0.0.1"
10    listen_port = 8080
11
12    # Initialize the proxy
13    proxy = AuthCaptureProxy(
14        target_url=target_url,
15        listen_address=listen_address,
16        listen_port=listen_port
17    )
18
19    print(f"Starting proxy on {listen_address}:{listen_port} -> {target_url}")
20    
21    # Start the proxy server
22    await proxy.start()
23
24if __name__ == "__main__":
25    try:
26        asyncio.run(main())
27    except KeyboardInterrupt:
28        pass
authcaptureproxy_quickstart_init_and_run_async_server.py - Raysurfer Public Snippets