api2pdf
Advanced tools
| Metadata-Version: 2.1 | ||
| Name: api2pdf | ||
| Version: 0.0.10 | ||
| Version: 0.0.11 | ||
| Summary: Wrapper for api2pdf.com library for converting html, urls, and word documents to pdf | ||
@@ -18,3 +18,3 @@ Home-page: https://github.com/api2pdf/api2pdf.python | ||
| - [Usage](#usage) | ||
| - [FAQ](#faq) | ||
| - [FAQ](https://www.api2pdf.com/faq) | ||
@@ -41,5 +41,4 @@ | ||
| ### Acquire API Key | ||
| 1. Create an account and login at [portal.api2pdf.com](https://portal.api2pdf.com) | ||
| 2. Add a balance to your account (no monthly commitment, sign up with as little as $1) | ||
| 3. Create an application and grab your API Key | ||
| Create an account at [portal.api2pdf.com](https://portal.api2pdf.com/register) to get your API key. | ||
@@ -216,25 +215,19 @@ ## <a name="#usage"></a>Usage | ||
| ``` | ||
| --- | ||
| ## <a name="faq"></a>FAQ | ||
| #### How do you bill? | ||
| $1 will be deducted from your balance every month as long as you maintain an active account. This charge begins 30 days after your first sign up for the service. In addition, we charge $0.001 per megabyte (data in + data out). We require customers to maintain a positive balance on their account to use the service. You can turn off auto-recharge at any time and let your funds run out if you no longer wish to use the service. See our [pricing calculator](https://www.api2pdf.com/pricing/). | ||
| **Delete a PDF on Command with delete(response_id)** | ||
| #### Do you offer free accounts? | ||
| The average customer spents about $2/month on our product. We do not have free accounts as this time. Feel free to check out alternatives and competitors. | ||
| By default, Api2Pdf will automatically delete your PDFs after 24 hours. If you have higher security requirements and need to delete the PDFs at-will, you can do so by calling the `delete(response_id)` method on the Api2Pdf object where `response_id` parameter comes from the responseId attribute in the Api2PdfResponse result. | ||
| #### Cancellation and refunds | ||
| We do not have any long term contracts. You can leave us at anytime with no further commitments. As our minimum cost is $1.00, we do not provide refunds. | ||
| ``` | ||
| from api2pdf import Api2Pdf | ||
| a2p_client = Api2Pdf('YOUR-API-KEY') | ||
| # generate a pdf | ||
| api_response = a2p_client.HeadlessChrome.convert_from_html('<p>Hello World</p>') | ||
| response_id = api_response.result['responseId'] | ||
| #### Are there any limits? | ||
| Api2Pdf does not set any specific limits on PDF file size, however our system does have processing power limitations. Each PDF request is provided 3 GB of RAM to work with and 90 seconds to generate the PDF. We offer WKHTMLTOPDF, Headless Chrome, and LibreOffice to do conversions. Our platform will have the same limits as those underlying components. If the underlying component fails to convert to PDF, it will also fail via our service. Some examples are: | ||
| # delete the pdf | ||
| a2p_client.delete(response_id) | ||
| ``` | ||
| - Password protected PDFs | ||
| - Encrypted PDFs | ||
| - HTML that references erroneous content | ||
| - Protected Office Documents | ||
| #### How long are PDFs stored on Api2Pdf.com? | ||
| After generating a PDF via the API, you are provided with a link to the file. This link will hold the PDF for 24 hours. If you wish to keep your PDF long term, download the file to your local cache. | ||
| Platform: UNKNOWN | ||
@@ -241,0 +234,0 @@ Classifier: Programming Language :: Python :: 3 |
+18
-2
@@ -11,6 +11,8 @@ import requests | ||
| API2PDF_LIBREOFFICE_CONVERT = API2PDF_BASE_ENDPOINT + '/libreoffice/convert' | ||
| API2PDF_DELETE_PDF = API2PDF_BASE_ENDPOINT + '/pdf/{response_id}' | ||
| class Api2Pdf(object): | ||
| def __init__(self, api_key): | ||
| def __init__(self, api_key, tag=''): | ||
| self.api_key = api_key | ||
| self.tag = tag | ||
@@ -38,2 +40,8 @@ @property | ||
| def delete(self, response_id): | ||
| headers = self.request_header | ||
| endpoint = API2PDF_DELETE_PDF.format(response_id=response_id) | ||
| response = requests.delete(endpoint, headers=headers) | ||
| return Api2PdfResponse(headers, endpoint, '', response) | ||
| def _make_html_payload(self, html, inline_pdf=False, file_name=None, **options): | ||
@@ -63,3 +71,3 @@ payload = { | ||
| def _make_request(self, endpoint, payload): | ||
| headers = {'Authorization': self.api_key} | ||
| headers = self.request_header | ||
| payload_as_json = json.dumps(payload) | ||
@@ -69,2 +77,10 @@ response = requests.post(endpoint, data=payload_as_json, headers=headers) | ||
| @property | ||
| def request_header(self): | ||
| header = {} | ||
| header['Authorization'] = self.api_key | ||
| if self.tag: | ||
| header['Tag'] = self.tag | ||
| return header | ||
| class Api2Pdf_WkHtmlToPdf(Api2Pdf): | ||
@@ -71,0 +87,0 @@ def convert_from_html(self, html, inline_pdf=False, file_name=None, **options): |
+16
-23
| Metadata-Version: 2.1 | ||
| Name: api2pdf | ||
| Version: 0.0.10 | ||
| Version: 0.0.11 | ||
| Summary: Wrapper for api2pdf.com library for converting html, urls, and word documents to pdf | ||
@@ -18,3 +18,3 @@ Home-page: https://github.com/api2pdf/api2pdf.python | ||
| - [Usage](#usage) | ||
| - [FAQ](#faq) | ||
| - [FAQ](https://www.api2pdf.com/faq) | ||
@@ -41,5 +41,4 @@ | ||
| ### Acquire API Key | ||
| 1. Create an account and login at [portal.api2pdf.com](https://portal.api2pdf.com) | ||
| 2. Add a balance to your account (no monthly commitment, sign up with as little as $1) | ||
| 3. Create an application and grab your API Key | ||
| Create an account at [portal.api2pdf.com](https://portal.api2pdf.com/register) to get your API key. | ||
@@ -216,25 +215,19 @@ ## <a name="#usage"></a>Usage | ||
| ``` | ||
| --- | ||
| ## <a name="faq"></a>FAQ | ||
| #### How do you bill? | ||
| $1 will be deducted from your balance every month as long as you maintain an active account. This charge begins 30 days after your first sign up for the service. In addition, we charge $0.001 per megabyte (data in + data out). We require customers to maintain a positive balance on their account to use the service. You can turn off auto-recharge at any time and let your funds run out if you no longer wish to use the service. See our [pricing calculator](https://www.api2pdf.com/pricing/). | ||
| **Delete a PDF on Command with delete(response_id)** | ||
| #### Do you offer free accounts? | ||
| The average customer spents about $2/month on our product. We do not have free accounts as this time. Feel free to check out alternatives and competitors. | ||
| By default, Api2Pdf will automatically delete your PDFs after 24 hours. If you have higher security requirements and need to delete the PDFs at-will, you can do so by calling the `delete(response_id)` method on the Api2Pdf object where `response_id` parameter comes from the responseId attribute in the Api2PdfResponse result. | ||
| #### Cancellation and refunds | ||
| We do not have any long term contracts. You can leave us at anytime with no further commitments. As our minimum cost is $1.00, we do not provide refunds. | ||
| ``` | ||
| from api2pdf import Api2Pdf | ||
| a2p_client = Api2Pdf('YOUR-API-KEY') | ||
| # generate a pdf | ||
| api_response = a2p_client.HeadlessChrome.convert_from_html('<p>Hello World</p>') | ||
| response_id = api_response.result['responseId'] | ||
| #### Are there any limits? | ||
| Api2Pdf does not set any specific limits on PDF file size, however our system does have processing power limitations. Each PDF request is provided 3 GB of RAM to work with and 90 seconds to generate the PDF. We offer WKHTMLTOPDF, Headless Chrome, and LibreOffice to do conversions. Our platform will have the same limits as those underlying components. If the underlying component fails to convert to PDF, it will also fail via our service. Some examples are: | ||
| # delete the pdf | ||
| a2p_client.delete(response_id) | ||
| ``` | ||
| - Password protected PDFs | ||
| - Encrypted PDFs | ||
| - HTML that references erroneous content | ||
| - Protected Office Documents | ||
| #### How long are PDFs stored on Api2Pdf.com? | ||
| After generating a PDF via the API, you are provided with a link to the file. This link will hold the PDF for 24 hours. If you wish to keep your PDF long term, download the file to your local cache. | ||
| Platform: UNKNOWN | ||
@@ -241,0 +234,0 @@ Classifier: Programming Language :: Python :: 3 |
+15
-22
@@ -10,3 +10,3 @@ # api2pdf.python | ||
| - [Usage](#usage) | ||
| - [FAQ](#faq) | ||
| - [FAQ](https://www.api2pdf.com/faq) | ||
@@ -33,5 +33,4 @@ | ||
| ### Acquire API Key | ||
| 1. Create an account and login at [portal.api2pdf.com](https://portal.api2pdf.com) | ||
| 2. Add a balance to your account (no monthly commitment, sign up with as little as $1) | ||
| 3. Create an application and grab your API Key | ||
| Create an account at [portal.api2pdf.com](https://portal.api2pdf.com/register) to get your API key. | ||
@@ -208,23 +207,17 @@ ## <a name="#usage"></a>Usage | ||
| ``` | ||
| --- | ||
| ## <a name="faq"></a>FAQ | ||
| #### How do you bill? | ||
| $1 will be deducted from your balance every month as long as you maintain an active account. This charge begins 30 days after your first sign up for the service. In addition, we charge $0.001 per megabyte (data in + data out). We require customers to maintain a positive balance on their account to use the service. You can turn off auto-recharge at any time and let your funds run out if you no longer wish to use the service. See our [pricing calculator](https://www.api2pdf.com/pricing/). | ||
| **Delete a PDF on Command with delete(response_id)** | ||
| #### Do you offer free accounts? | ||
| The average customer spents about $2/month on our product. We do not have free accounts as this time. Feel free to check out alternatives and competitors. | ||
| By default, Api2Pdf will automatically delete your PDFs after 24 hours. If you have higher security requirements and need to delete the PDFs at-will, you can do so by calling the `delete(response_id)` method on the Api2Pdf object where `response_id` parameter comes from the responseId attribute in the Api2PdfResponse result. | ||
| #### Cancellation and refunds | ||
| We do not have any long term contracts. You can leave us at anytime with no further commitments. As our minimum cost is $1.00, we do not provide refunds. | ||
| ``` | ||
| from api2pdf import Api2Pdf | ||
| a2p_client = Api2Pdf('YOUR-API-KEY') | ||
| # generate a pdf | ||
| api_response = a2p_client.HeadlessChrome.convert_from_html('<p>Hello World</p>') | ||
| response_id = api_response.result['responseId'] | ||
| #### Are there any limits? | ||
| Api2Pdf does not set any specific limits on PDF file size, however our system does have processing power limitations. Each PDF request is provided 3 GB of RAM to work with and 90 seconds to generate the PDF. We offer WKHTMLTOPDF, Headless Chrome, and LibreOffice to do conversions. Our platform will have the same limits as those underlying components. If the underlying component fails to convert to PDF, it will also fail via our service. Some examples are: | ||
| - Password protected PDFs | ||
| - Encrypted PDFs | ||
| - HTML that references erroneous content | ||
| - Protected Office Documents | ||
| #### How long are PDFs stored on Api2Pdf.com? | ||
| After generating a PDF via the API, you are provided with a link to the file. This link will hold the PDF for 24 hours. If you wish to keep your PDF long term, download the file to your local cache. | ||
| # delete the pdf | ||
| a2p_client.delete(response_id) | ||
| ``` |
+1
-1
@@ -8,3 +8,3 @@ import setuptools | ||
| name="api2pdf", | ||
| version="0.0.10", | ||
| version="0.0.11", | ||
| author="Zack Schwartz", | ||
@@ -11,0 +11,0 @@ author_email="support@api2pdf.com", |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
143
10.85%37277
-7.86%