Python botocore.vendored.requests.Session() Examples

The following are 4 code examples of botocore.vendored.requests.Session(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module botocore.vendored.requests , or try the search function .
Example #1
Source File: send_logs.py    From cloud-bots with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def send_logs(message, start_time, vendor):
    account_mode = os.getenv('ACCOUNT_MODE', '')
    cross_account_role_name = os.getenv('CROSS_ACCOUNT_ROLE_NAME', '')
    output_type = os.getenv('OUTPUT_TYPE', '')
    execution_time = time.time() - start_time
    session = requests.Session()
    for bot in message.get('Rules violations found'):
        del bot['ID']
        del bot['Name']
    headers = {"Content-Type": "application/json", "Accept": "application/json", "X-Sumo-Name": message.get('Account id'), "X-Sumo-Category": vendor}
    data = {'msg': message,
            'account_mode': account_mode,
            'cross_account_role_name': cross_account_role_name,
            'output_type': output_type,
            'execution_time': execution_time}
    r = session.post(SUMO_HTTP_ENDPOINT, headers=headers, data=json.dumps(data))
    print(f'{__file__} - status code from dome9 logs: {r.status_code}')
    return 
Example #2
Source File: utils.py    From faces with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, session=None, sleep=time.sleep):
        if session is None:
            session = requests.Session()
        self._session = session
        self._sleep = sleep 
Example #3
Source File: utils.py    From faces with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, session=None, sleep=time.sleep):
        if session is None:
            session = requests.Session()
        self._session = session
        self._sleep = sleep 
Example #4
Source File: utils.py    From aws-extender with MIT License 5 votes vote down vote up
def __init__(self, session=None, sleep=time.sleep):
        if session is None:
            session = requests.Session()
        self._session = session
        self._sleep = sleep