def test_get_shared_link_header(shared_link, password):
    # pylint:disable=redefined-outer-name
    header = get_shared_link_header(shared_link, password)
    assert 'BoxApi' in header
    assert shared_link in header['BoxApi']
    if password is not None:
        assert password in header['BoxApi']
def test_get_shared_link_header(shared_link, password):
    # pylint:disable=redefined-outer-name
    header = get_shared_link_header(shared_link, password)
    assert 'BoxApi' in header
    assert shared_link in header['BoxApi']
    if password is not None:
        assert password in header['BoxApi']
def box_api_headers(shared_link, shared_link_password, access_token):
    # pylint:disable=redefined-outer-name
    box_api_header = get_shared_link_header(shared_link,
                                            shared_link_password)['BoxApi']
    return {
        'Authorization': 'Bearer {0}'.format(access_token),
        'BoxApi': box_api_header
    }
def box_api_headers(shared_link, shared_link_password, access_token):
    # pylint:disable=redefined-outer-name
    box_api_header = get_shared_link_header(shared_link, shared_link_password)['BoxApi']
    return {
        'Authorization': 'Bearer {0}'.format(access_token),
        'BoxApi': box_api_header,
        'User-Agent': Client.USER_AGENT_STRING,
    }
def box_api_headers(shared_link, shared_link_password, access_token):
    # pylint:disable=redefined-outer-name
    box_api_header = get_shared_link_header(shared_link,
                                            shared_link_password)['BoxApi']
    return {
        'Authorization': 'Bearer {0}'.format(access_token),
        'BoxApi': box_api_header,
        'User-Agent': Client.USER_AGENT_STRING,
        'X-Box-UA': Client.BOX_UA_STRING,
    }
Exemplo n.º 6
0
    def with_shared_link(self, shared_link, shared_link_password=None):
        """
        Returns a new session object with default headers set up to make requests using the shared link for auth.

        :param shared_link:
            The shared link.
        :type shared_link:
            `unicode`
        :param shared_link_password:
            The password for the shared link.
        :type shared_link_password:
            `unicode`
        """
        headers = self._default_headers.copy()
        headers.update(get_shared_link_header(shared_link, shared_link_password))
        return self.__class__(self._oauth, self._network_layer, headers)
Exemplo n.º 7
0
    def with_shared_link(self, shared_link, shared_link_password=None):
        """
        Returns a new session object with default headers set up to make requests using the shared link for auth.

        :param shared_link:
            The shared link.
        :type shared_link:
            `unicode`
        :param shared_link_password:
            The password for the shared link.
        :type shared_link_password:
            `unicode`
        """
        headers = self._default_headers.copy()
        headers.update(
            get_shared_link_header(shared_link, shared_link_password))
        return self.__class__(self._oauth, self._network_layer, headers)