我正在使用python中的请求库发出HTTP请求,但是我需要来自响应http请求的服务器的ip地址,并且我试图避免进行两次调用(并且可能有一个不同的ip地址来自响应的那个请求.
那可能吗?有没有python http库允许我这样做?
ps:我还需要发出HTTPS请求并使用经过身份验证的代理.
更新1:
例:
import requests
proxies = {
"http": "http://user:password@10.10.1.10:3128",
"https": "http://user:password@10.10.1.10:1080",
}
response = requests.get("http://example.org", proxies=proxies)
response.ip # This doesn't exist, this is just an what I would like to do
Run Code Online (Sandbox Code Playgroud)
那么,我想知道从响应中的方法或属性连接的IP地址请求.在其他库中,我能够通过找到sock对象并使用getpeername()方法来做到这一点.
我有一个任务是检查网址速度,但我希望由不同服务器中的多个芹菜工人执行.我希望多个工作人员检查相同的网址.
我怎样才能做到这一点?
我已经在 Google Cloud 上创建了一个 Kubernetes 集群,尽管应用程序运行正常(我已经检查了集群内的运行请求),但 NEG 运行状况检查似乎无法正常工作。关于原因有什么想法吗?
我尝试将服务从 NodePort 更改为 LoadBalancer,通过不同的方式向服务添加注释。我在想也许这可能与 django 端的 https 要求有关。
# [START kubernetes_deployment]
apiVersion: apps/v1
kind: Deployment
metadata:
name: moner-app
labels:
app: moner-app
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: moner-app
template:
metadata:
labels:
app: moner-app
spec:
containers:
- name: moner-core-container
image: my-template
imagePullPolicy: Always
resources:
requests:
memory: "128Mi"
limits:
memory: "512Mi"
startupProbe:
httpGet:
path: /ht/
port: 5000
httpHeaders:
- name: "X-Forwarded-Proto"
value: "https"
failureThreshold: 30
timeoutSeconds: 10
periodSeconds: 10
initialDelaySeconds: 90 …
Run Code Online (Sandbox Code Playgroud) google-compute-engine django-deployment kubernetes google-kubernetes-engine