Send request to Kubernetes cluster using python script

12/19/2019

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

-- Naeem Khan
api
deployment
google-cloud-platform
kubernetes
python

1 Answer

12/19/2019

This is an example on how to use python requests library to send files to your endpoint.

import requests

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

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

print(response.text)
-- marxmacher
Source: StackOverflow