-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlive_endpoint_query.py
More file actions
31 lines (26 loc) · 910 Bytes
/
live_endpoint_query.py
File metadata and controls
31 lines (26 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
Example script for querying the live API hosted on
Heroku.
"""
import os
import requests
# URL = "https://award40-udacity.herokuapp.com"
URL = "http://127.0.0.1:8000"
response = requests.post(os.path.join(URL, "model"), json={
"age": 55,
"workclass": "Private",
"fnlgt": 77516,
"education": "Masters",
"education-num": 16,
"marital-status": "Never-married",
"occupation": "Adm-clerical",
"relationship": "Not-in-family",
"race": "White",
"sex": "Female",
"capital-gain": 10000,
"capital-loss": 400,
"hours-per-week": 45,
"native-country": "United-States",
})
print(response.status_code)
print(response.json())