コード例 #1
0
    def test_get_file(self):
        request = HSRequest(self.client.auth)
        f = tempfile.NamedTemporaryFile(delete=True)
        temp_filename = f.name
        f.close()
        response = request.get_file(url='http://httpbin.org/robots.txt',
                                    headers={'Custom-Header': 'Nothing'},
                                    filename=temp_filename)
        os.unlink(temp_filename)
        self.assertEquals(response, True)

        response = request.get_file(url='https://httpbin.org/robots.txt',
                                    headers={'Custom-Header': 'Nothing'},
                                    filename=temp_filename)
        os.unlink(temp_filename)
        self.assertEquals(response, True)

        response = request.get_file(url='http://httpbin.org/robots.txt',
                                    headers={'Custom-Header': 'Nothing'},
                                    filename='')
        self.assertEquals(response, False)

        response = request.get_file(url='https://httpbin.org/robots.txt',
                                    headers={'Custom-Header': 'Nothing'},
                                    filename='')
        self.assertEquals(response, False)
コード例 #2
0
    def get_signature_request_file(self, signature_request_id, filename):
        """Download the PDF copy of the current documents

        Args:
            signature_request_id (str): ID of the Signature Request
            filename (str): Filename to save the PDF file to. This should be a
            full path.

        Returns:
            True if file is downloaded and written successfully, False
            otherwise.

        """

        request = HSRequest(self.auth)
        return request.get_file(
            self.SIGNATURE_REQUEST_DOWNLOAD_PDF_URL + signature_request_id,
            filename)
コード例 #3
0
    def get_signature_request_file(self, signature_request_id, filename):
        """Download the PDF copy of the current documents

        Args:
            signature_request_id (str): ID of the Signature Request
            filename (str): Filename to save the PDF file to. This should be a
            full path.

        Returns:
            True if file is downloaded and written successfully, False
            otherwise.

        """

        request = HSRequest(self.auth)
        return request.get_file(
            self.SIGNATURE_REQUEST_DOWNLOAD_PDF_URL + signature_request_id,
            filename)
コード例 #4
0
    def get_signature_request_final_copy(self, signature_request_id, filename):
        # This api call is DEPRECATED
        """Download the PDF copy of the finalized documents

        Download the PDF copy of the finalized documents specified by the
        `signature_request_id` parameter
        Warning: This API call is deprecated. Use `get_signature_request_file`
        instead.

        Args:
            signature_request_id (str): ID of the Signature Request
            filename (str): Filename to save the PDF file to. This should be a
            full path.

        Returns:
            True if file is downloaded and written successfully, False
            otherwise.

        """

        request = HSRequest(self.auth)
        return request.get_file(
            self.SIGNATURE_REQUEST_DOWNLOAD_FINAL_COPY_URL +
            signature_request_id, filename)
コード例 #5
0
    def get_signature_request_final_copy(self, signature_request_id, filename):
        # This api call is DEPRECATED
        """Download the PDF copy of the finalized documents

        Download the PDF copy of the finalized documents specified by the
        `signature_request_id` parameter
        Warning: This API call is deprecated. Use `get_signature_request_file`
        instead.

        Args:
            signature_request_id (str): ID of the Signature Request
            filename (str): Filename to save the PDF file to. This should be a
            full path.

        Returns:
            True if file is downloaded and written successfully, False
            otherwise.

        """

        request = HSRequest(self.auth)
        return request.get_file(
            self.SIGNATURE_REQUEST_DOWNLOAD_FINAL_COPY_URL +
            signature_request_id, filename)