Created
July 22, 2021 16:38
-
-
Save sdelquin/e0dc721c25b194dfc11e994cca0d3cd2 to your computer and use it in GitHub Desktop.
Check tools from pylovepdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from prettyconf import config | |
from pylovepdf import ILovePdf | |
PUBLIC_KEY = config('ILOVEPDF_PUBLIC_KEY') | |
# tool names as described in https://github.com/AndyCyberSec/pylovepdf#tools | |
TOOLS = [ | |
'compress', | |
'imagepdf', | |
'merge', | |
'officepdf', | |
'pagenumber', | |
'pdfa', | |
'pdfjpg', | |
'protect', | |
'rotate', | |
'split', | |
'unlock', | |
'validatepdfa', | |
'watermark', | |
] | |
ilovepdf = ILovePdf(PUBLIC_KEY, verify_ssl=True) | |
for tool in TOOLS: | |
sys.stdout = open(os.devnull, 'w') | |
try: | |
task = ilovepdf.new_task(tool) | |
task.debug = False | |
task.delete_current_task() | |
except Exception as err: | |
sys.stdout = sys.__stdout__ | |
print(f'TOOL: {tool}') | |
print(err) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment