Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | import requests |
| 2 | from robot.api import logger |
| 3 | |
| 4 | valid_status_codes = [ |
| 5 | requests.codes.ok, |
| 6 | requests.codes.accepted |
| 7 | ] |
| 8 | |
| 9 | |
| 10 | def session_without_env(): |
| 11 | session = requests.Session() |
| 12 | session.trust_env = False |
| 13 | return session |
| 14 | |
| 15 | |
| 16 | def checkStatusCode(status_code, server_name): |
| 17 | if status_code not in valid_status_codes: |
| 18 | logger.error("Response status code from " + server_name + ": " + str(status_code)) |
| 19 | raise (Exception(server_name + " returned status code " + status_code)) |