我有以下docker-compose:
version: '3'
services:
mitmproxy:
image: johnmccabe/mitmweb
container_name: mitmproxy
command: --cadir /ca --wiface 0.0.0.0
restart: always
ports:
#- "8080:8080"
- "8081:8081"
python:
image: python
build: ./python-socks-example
command: python3 /home/project/socks-example.py
volumes:
- ./python-socks-example:/home/project/
depends_on:
- mitmproxy
container_name: python
restart: always
我希望我的python HTTP请求通过另一个容器上的mitmproxy。这是python代码:
import requests
import time
while(True):
time.sleep(5)
print("gonna connect")
resp = requests.get('http://google.com',
proxies=dict(http='socks5://user:pass@server.com:8080',
https='socks5://user:pass@server.com:8080'))
print(resp)
print("done")
time.sleep(2)
如何连接python
的网络以通过mitmproxy
容器?