def __init__(self, credentials, *, scopes=None,<EOL>proxy_server=None, proxy_port=<NUM_LIT>, proxy_username=None,<EOL>proxy_password=None, requests_delay=<NUM_LIT:200>, raise_http_errors=True,<EOL>request_retries=<NUM_LIT:3>, token_file_name=None, token_backend=None,<EOL>tenant_id='<STR_LIT>', **kwargs):
if not isinstance(credentials, tuple) or len(credentials) != <NUM_LIT:2> or (<EOL>not credentials[<NUM_LIT:0>] and not credentials[<NUM_LIT:1>]):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>self.auth = credentials<EOL>self.scopes = scopes<EOL>self.store_token = True<EOL>if token_file_name is not None:<EOL><INDENT>warnings.warn('<STR_LIT>'<EOL>'<STR_LIT>', DeprecationWarning)<EOL><DEDENT>token_backend = token_backend or FileSystemTokenBackend(token_filename=token_file_name)<EOL>if not isinstance(token_backend, BaseTokenBackend):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>self.token_backend = token_backend<EOL>self.session = None  <EOL>self.proxy = {}<EOL>self.set_proxy(proxy_server, proxy_port, proxy_username, proxy_password)<EOL>self.requests_delay = requests_delay or <NUM_LIT:0><EOL>self._previous_request_at = None  <EOL>self.raise_http_errors = raise_http_errors<EOL>self.request_retries = request_retries<EOL>self.naive_session = Session()  <EOL>self.naive_session.proxies = self.proxy<EOL>if self.request_retries:<EOL><INDENT>retry = Retry(total=self.request_retries, read=self.request_retries,<EOL>connect=self.request_retries,<EOL>backoff_factor=RETRIES_BACKOFF_FACTOR,<EOL>status_forcelist=RETRIES_STATUS_LIST)<EOL>adapter = HTTPAdapter(max_retries=retry)<EOL>self.naive_session.mount('<STR_LIT>', adapter)<EOL>self.naive_session.mount('<STR_LIT>', adapter)<EOL><DEDENT>self._oauth2_authorize_url = '<STR_LIT>''<STR_LIT>'.format(tenant_id)<EOL>self._oauth2_token_url = '<STR_LIT>''<STR_LIT>'.format(tenant_id)<EOL>
Creates an API connection object

        :param tuple credentials: a tuple of (client_id, client_secret)

         Generate client_id and client_secret in https://apps.dev.microsoft.com
        :param list[str] scopes: list of scopes to request access to
        :param str proxy_server: the proxy server
        :param int proxy_port: the proxy port, defaults to 8080
        :param str proxy_username: the proxy username
        :param str proxy_password: the proxy password
        :param int requests_delay: number of milliseconds to wait between api
         calls.

         The Api will respond with 429 Too many requests if more than
         17 requests are made per second. Defaults to 200 milliseconds
         just in case more than 1 connection is making requests
         across multiple processes.
        :param bool raise_http_errors: If True Http 4xx and 5xx status codes
         will raise as exceptions
        :param int request_retries: number of retries done when the server
         responds with 5xx error codes.
        :param str token_file_name: custom token file name to be used when
         storing the OAuth token credentials.
        :param BaseTokenBackend token_backend: the token backend used to get
         and store tokens
        :param str tenant_id: use this specific tenant id, defaults to common
        :param dict kwargs: any extra params passed to Connection
        :raises ValueError: if credentials is not tuple of
         (client_id, client_secret)