使用python脚本向Kubernetes集群发送请求

2024-04-26 13:11:47 发布

您现在位置:Python中文网/ 问答频道 /正文

I have deployed python API to google kubernetes cluster. I have get response using command line terminal as well as using my web browser . Now I want to send request using python script . Can anybody guide me how actually I connect my python script to google cloud kubernetes cluster and get my response to show in my python application .Thank you


Tags: toapigetresponsemyhaveasgoogle
1条回答
网友
1楼 · 发布于 2024-04-26 13:11:47

这是一个关于如何使用python请求库将文件发送到端点的示例。你知道吗

import requests

url = "https://your.domain/end_point"
files = {'image': open('{file_path}', 'rb')}

response = requests.request("POST", url, files=files)

print(response.text)

相关问题 更多 >