<commit_before>import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *

''' IMPORTS '''

import json
import requests

# Disable insecure warnings
requests.packages.urllib3.disable_warnings()

''' GLOBALS/PARAMS '''

USERNAME = demisto.params().get('credentials', {}).get('identifier')
PASSWORD = demisto.params().get('credentials', {}).get('password')
API_KEY = demisto.params().get('key')
SYSTEM_NAME = demisto.params().get('system_name')
# Remove trailing slash to prevent wrong URL path to service
SERVER = demisto.params()['url'][:-1] \
    if (demisto.params()['url'] and demisto.params()['url'].endswith('/')) else demisto.params()['url']
# Should we use SSL
USE_SSL = not demisto.params().get('insecure', False)
# Service base URL
BASE_URL = SERVER + '/BeyondTrust/api/public/v3'
# Headers to be sent in requests
HEADERS = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
}

SESSION = requests.session()
ERR_DICT = {
    '4031': 'User does not have permission.',
    '4034': 'Request is not yet approved.',
    '4091': 'Conflicting request exists. This user or another user has already requested a password for the'
            'specified account'
}


''' HELPER FUNCTIONS '''


def http_request(method: str, suffix_url: str, data: str = None):
    """
    A wrapper for requests lib to send our requests and handle requests
    and responses better

    Parameters
    ----------
    method : str
        HTTP method, e.g. 'GET', 'POST' ... etc.
    suffix_url : str
        API endpoint.
    data : str<commit_msg>Adding PEP 484 to http request<commit_after>import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *

''' IMPORTS '''

import json
import requests

# Disable insecure warnings
requests.packages.urllib3.disable_warnings()

''' GLOBALS/PARAMS '''

USERNAME = demisto.params().get('credentials', {}).get('identifier')
PASSWORD = demisto.params().get('credentials', {}).get('password')
API_KEY = demisto.params().get('key')
SYSTEM_NAME = demisto.params().get('system_name')
# Remove trailing slash to prevent wrong URL path to service
SERVER = demisto.params()['url'][:-1] \
    if (demisto.params()['url'] and demisto.params()['url'].endswith('/')) else demisto.params()['url']
# Should we use SSL
USE_SSL = not demisto.params().get('insecure', False)
# Service base URL
BASE_URL = SERVER + '/BeyondTrust/api/public/v3'
# Headers to be sent in requests
HEADERS = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
}

SESSION = requests.session()
ERR_DICT = {
    '4031': 'User does not have permission.',
    '4034': 'Request is not yet approved.',
    '4091': 'Conflicting request exists. This user or another user has already requested a password for the'
            'specified account'
}


''' HELPER FUNCTIONS '''


def http_request(method: str, suffix_url: str, data=None):
    """
    A wrapper for requests lib to send our requests and handle requests
    and responses better

    Parameters
    ----------
    method : str
        HTTP method, e.g. 'GET', 'POST' ... etc.
    suffix_url : str
        API endpoint.
    data : str
{'fraction_non_alphanumeric': 0.14415259537210756, 'fraction_numerical': 0.010318949343339587, 'mean_word_length': 3.8543247344461307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3436411', 'n_tokens_mistral': 989, 'n_tokens_neox': 948, 'n_words': 294}