Python marshmallow.fields.URL Examples

The following are 6 code examples of marshmallow.fields.URL(). 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 marshmallow.fields , or try the search function .
Example #1
Source File: connection_invitation.py    From aries-cloudagent-python with Apache License 2.0 6 votes vote down vote up
def from_url(cls, url: str) -> "ConnectionInvitation":
        """
        Parse a URL-encoded invitation into a `ConnectionInvitation` message.

        Args:
            url: Url to decode

        Returns:
            A `ConnectionInvitation` object.

        """
        parts = urlparse(url)
        query = parse_qs(parts.query)
        if "c_i" in query:
            c_i = b64_to_bytes(query["c_i"][0], urlsafe=True)
            return cls.from_json(c_i)
        return None 
Example #2
Source File: plist_schema.py    From commandment with MIT License 6 votes vote down vote up
def wrap_payload_content(self, data: dict) -> dict:
        """SCEP Payload is silly and double wraps its PayloadContent item."""
        inner_content = {
            'URL': data.pop('URL', None),
            'Name': data.pop('Name'),
            'Challenge': data.pop('Challenge'),
            'Keysize': data.pop('Keysize'),
            'CAFingerprint': data.pop('CAFingerprint'),
            'KeyType': data.pop('KeyType'),
            'KeyUsage': data.pop('KeyUsage'),
            'Retries': data.pop('Retries'),
            'RetryDelay': data.pop('RetryDelay'),
        }

        data['PayloadContent'] = inner_content
        return data 
Example #3
Source File: base.py    From pyrh with MIT License 6 votes vote down vote up
def base_paginator(seed_url: "URL", session_manager: "SessionManager", schema: Any) -> Iterable[Any]:  # type: ignore  # noqa: F821, E501
    """Create a paginator using the passed parameters.

    Args:
        seed_url: The url to get the first batch of results.
        session_manager: The session manager that will manage the get.
        schema: The Schema subclass used to build individual instances.

    Yields:
        Instances of the object passed in the schema field.

    """
    resource_endpoint = seed_url
    while True:
        paginator = session_manager.get(resource_endpoint, schema=schema)
        for instrument in paginator:
            yield instrument
        if paginator.next is not None:
            resource_endpoint = paginator.next
        else:
            break 
Example #4
Source File: connection_invitation.py    From aries-cloudagent-python with Apache License 2.0 5 votes vote down vote up
def __init__(
        self,
        *,
        label: str = None,
        did: str = None,
        recipient_keys: Sequence[str] = None,
        endpoint: str = None,
        routing_keys: Sequence[str] = None,
        image_url: str = None,
        **kwargs,
    ):
        """
        Initialize connection invitation object.

        Args:
            label: Optional label for connection
            did: DID for this connection invitation
            recipient_keys: List of recipient keys
            endpoint: Endpoint which this agent can be reached at
            routing_keys: List of routing keys
            image_url: Optional image URL for connection invitation
        """
        super(ConnectionInvitation, self).__init__(**kwargs)
        self.label = label
        self.did = did
        self.recipient_keys = list(recipient_keys) if recipient_keys else None
        self.endpoint = endpoint
        self.routing_keys = list(routing_keys) if routing_keys else None 
Example #5
Source File: connection_invitation.py    From aries-cloudagent-python with Apache License 2.0 5 votes vote down vote up
def to_url(self, base_url: str = None) -> str:
        """
        Convert an invitation to URL format for sharing.

        Returns:
            An invite url

        """
        c_json = self.to_json()
        c_i = bytes_to_b64(c_json.encode("ascii"), urlsafe=True)
        result = urljoin(base_url or self.endpoint or "", "?c_i={}".format(c_i))
        return result 
Example #6
Source File: models.py    From TitleDB with The Unlicense 5 votes vote down vote up
def url(cls):
        return relationship('URL')