ตัวอย่างการเรียก API ที่ Deploy บน Google Colab

import requests

response = requests.get("https://49a5-34-75-248-26.ngrok.io/hello")
print(response.json())
URL = 'https://e54f-34-75-248-26.ngrok.io/getclass'

data = {
  'x': -0.210738, 
  'y': -13.1719
}
response = requests.post(URL, json=data)
if response.status_code == 200:
    res = response.json()['results']
    print(res)
from requests.auth import HTTPBasicAuth
URL = 'https://325e-34-75-248-26.ngrok.io/getclass'

data = {
  'x': -0.210738, 
  'y': -13.1719
}

response = requests.post(URL, json=data, auth=HTTPBasicAuth('nuttachot', 'password'))
if response.status_code == 200:
    res = response.json()['results']
    print(res)