blob: c0dcd81d41adeaef6729f46986628cb5ed800c5a [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001import requests
2from robot.api import logger
3
4valid_status_codes = [
5 requests.codes.ok,
6 requests.codes.accepted
7]
8
9
10def session_without_env():
11 session = requests.Session()
12 session.trust_env = False
13 return session
14
15
16def 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))