Files
  • main.py
main.py
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
s = """the client's response was "Hi!" """
print(s)


s = '''\
#!/usr/bin/python3
"""Generic API call module to centralize options"""

import requests
import json
import config


def post(payload, url):
    headers = {'accept': 'application/json'}
    requests.packages.urllib3.disable_warnings()
    response = requests.post('https://' + config.HOST +
                             ':' + str(config.PORT) + url,
                             json=payload, headers=headers, verify=False)
    status = response.status_code
    if status == 200:
        response = json.loads(response.text)
    elif status == 204:
        response = response.text
    else:
        print(response.text)
        exit("API Call did not work properly")
    return response, status
'''
print(s)