How to use the okta.utils.format_url function in okta

To help you get started, we’ve selected a few okta examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github okta / okta-sdk-python / okta / resource_clients / user_factor_client.py View on Github external
async def activate_factor(
            self, userId, factorId, activate_factor_request
    ):
        """
        The `sms` and `token:software:totp` factor types requir
        e activation to complete the enrollment process.
        Args:
            user_id {str}
            factor_id {str}
            {activate_factor_request}
        Returns:
            UserFactor
        """
        http_method = "post".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/users/{userId}/factors/{factorId}/lifecycle
                /activate
            """)

        body = activate_factor_request.as_dict()
        headers = {
            "Accept": "application/json",
            "Content-Type": "application/json"
        }

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
github okta / okta-sdk-python / okta / resource_clients / session_client.py View on Github external
async def end_session(
            self, sessionId
    ):
        """
        Method for
        /api/v1/sessions/{sessionId}
        Args:
            session_id {str}
        """
        http_method = "delete".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/sessions/{sessionId}
            """)

        body = {}
        headers = {}

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
            return (None, error)

        response, error = await self._request_executor\
            .execute(request)
github okta / okta-sdk-python / okta / resource_clients / user_type_client.py View on Github external
async def list_user_types(
            self
    ):
        """
        Fetches all User Types in your org
        Args:
        Returns:
            list: Collection of UserType instances.
        """
        http_method = "get".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/meta/types/user
            """)

        body = {}
        headers = {}

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
            return (None, None, error)

        response, error = await self._request_executor\
            .execute(request, UserType)
github okta / okta-sdk-python / okta / resource_clients / authorization_server_client.py View on Github external
async def get_refresh_token_for_authorization_server_and_client(
            self, authServerId, clientId, tokenId, query_params={}
    ):
        """
        Args:
            auth_server_id {str}
            client_id {str}
            token_id {str}
            query_params {dict}: Map of query parameters for request
            [query_params.expand] {str}
        Returns:
            OAuth2RefreshToken
        """
        http_method = "get".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/authorizationServers/{authServerId}/clients
                /{clientId}/tokens/{tokenId}
            """)
        if query_params:
            encoded_query_params = urlencode(query_params)
            api_url += f"/?{encoded_query_params}"

        body = {}
        headers = {}

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
github okta / okta-sdk-python / okta / resource_clients / sms_template_client.py View on Github external
async def partial_update_sms_template(
            self, templateId, sms_template
    ):
        """
        Updates only some of the SMS template properties:
        Args:
            template_id {str}
            {sms_template}
        Returns:
            SmsTemplate
        """
        http_method = "post".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/templates/sms/{templateId}
            """)

        body = sms_template.as_dict()
        headers = {
            "Accept": "application/json",
            "Content-Type": "application/json"
        }

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
            return (None, None, error)
github okta / okta-sdk-python / okta / resource_clients / feature_client.py View on Github external
async def list_features(
            self
    ):
        """
        Args:
        Returns:
            list: Collection of Feature instances.
        """
        http_method = "get".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/features
            """)

        body = {}
        headers = {}

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
            return (None, None, error)

        response, error = await self._request_executor\
            .execute(request, Feature)
github okta / okta-sdk-python / okta / resource_clients / event_hook_client.py View on Github external
async def delete_event_hook(
            self, eventHookId
    ):
        """
        Args:
            event_hook_id {str}
        """
        http_method = "delete".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/eventHooks/{eventHookId}
            """)

        body = {}
        headers = {}

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
            return (None, error)

        response, error = await self._request_executor\
            .execute(request)
github okta / okta-sdk-python / okta / resource_clients / user_client.py View on Github external
"""
        Gets a refresh token issued for the specified User and
        Client.
        Args:
            user_id {str}
            client_id {str}
            token_id {str}
            query_params {dict}: Map of query parameters for request
            [query_params.expand] {str}
            [query_params.limit] {str}
            [query_params.after] {str}
        Returns:
            OAuth2RefreshToken
        """
        http_method = "get".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/users/{userId}/clients/{clientId}/tokens
                /{tokenId}
            """)
        if query_params:
            encoded_query_params = urlencode(query_params)
            api_url += f"/?{encoded_query_params}"

        body = {}
        headers = {}

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
github okta / okta-sdk-python / okta / resource_clients / log_event_client.py View on Github external
ganization’s system log. This API provides more functio
        nality than the Events API
        Args:
            query_params {dict}: Map of query parameters for request
            [query_params.until] {str}
            [query_params.since] {str}
            [query_params.filter] {str}
            [query_params.q] {str}
            [query_params.limit] {str}
            [query_params.sortOrder] {str}
            [query_params.after] {str}
        Returns:
            list: Collection of LogEvent instances.
        """
        http_method = "get".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/logs
            """)
        if query_params:
            encoded_query_params = urlencode(query_params)
            api_url += f"/?{encoded_query_params}"

        body = {}
        headers = {}

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
            return (None, None, error)
github okta / okta-sdk-python / okta / resource_clients / linked_object_client.py View on Github external
async def add_linked_object_definition(
            self, linked_object
    ):
        """
        Args:
            {linked_object}
        Returns:
            LinkedObject
        """
        http_method = "post".upper()
        api_url = format_url(f"""
            {self._base_url}
            /api/v1/meta/schemas/user/linkedObjects
            """)

        body = linked_object.as_dict()
        headers = {
            "Accept": "application/json",
            "Content-Type": "application/json"
        }

        request, error = await self._request_executor.create_request(
            http_method, api_url, body, headers
        )

        if error:
            return (None, None, error)