From 16eaa713bb19fb2d1d52bc704e0e78fc46676700 Mon Sep 17 00:00:00 2001 From: GrabzIt Date: Wed, 17 Jan 2018 12:19:22 +0000 Subject: [PATCH] Added the ability to specify HTTP proxies in the Python API. --- python/GrabzIt/GrabzItBaseOptions.py | 3 ++- python/GrabzIt/GrabzItDOCXOptions.py | 2 +- python/GrabzIt/GrabzItException.py | 1 + python/GrabzIt/GrabzItImageOptions.py | 2 +- python/GrabzIt/GrabzItPDFOptions.py | 2 +- python/GrabzIt/GrabzItTableOptions.py | 2 +- python/setup.py | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/python/GrabzIt/GrabzItBaseOptions.py b/python/GrabzIt/GrabzItBaseOptions.py index a851757e..37eeb95a 100644 --- a/python/GrabzIt/GrabzItBaseOptions.py +++ b/python/GrabzIt/GrabzItBaseOptions.py @@ -22,6 +22,7 @@ def __init__(self): self.encryptionKey = "" self.delay = 0 self.post = "" + self.proxy = "" def _appendParameter(self, qs, name, value): val = "" @@ -40,4 +41,4 @@ def _appendParameter(self, qs, name, value): return qs def _createParameters(self, applicationKey, sig, callBackURL, dataName, dataValue): - return {"key":str(applicationKey), "country": str(self.country), "export": str(self.exportURL), "encryption": str(self.encryptionKey), "customid": str(self.customId), "callback": str(callBackURL), "sig": str(sig), str(dataName):str(dataValue)} \ No newline at end of file + return {"key":str(applicationKey), "country": str(self.country), "export": str(self.exportURL), "encryption": str(self.encryptionKey), "proxy": str(self.proxy), "customid": str(self.customId), "callback": str(callBackURL), "sig": str(sig), str(dataName):str(dataValue)} \ No newline at end of file diff --git a/python/GrabzIt/GrabzItDOCXOptions.py b/python/GrabzIt/GrabzItDOCXOptions.py index 5f6e6348..275828d3 100644 --- a/python/GrabzIt/GrabzItDOCXOptions.py +++ b/python/GrabzIt/GrabzItDOCXOptions.py @@ -116,4 +116,4 @@ def _getSignatureString(self, applicationSecret, callBackURL, url = ''): "|"+str(int(self.marginLeft))+"|"+str(int(self.marginBottom))+"|"+str(int(self.marginRight))+"|"+str(int(self.delay))+"|"+str(int(self.requestAs))+ \ "|"+str(self.country)+"|"+str(int(self.quality))+"|"+str(self.hideElement)+"|"+str(self.exportURL)+"|"+str(self.waitForElement)+\ "|"+str(self.encryptionKey)+"|"+str(int(self.noAds))+"|"+str(self.post)+"|"+str(self.targetElement)+"|"+str(self.templateId)+"|"+\ - str(self.templateVariables)+"|"+str(int(self.pageHeight))+"|"+str(int(self.pageWidth))+"|"+str(int(self.browserWidth)) \ No newline at end of file + str(self.templateVariables)+"|"+str(int(self.pageHeight))+"|"+str(int(self.pageWidth))+"|"+str(int(self.browserWidth))+"|"+str(self.proxy) \ No newline at end of file diff --git a/python/GrabzIt/GrabzItException.py b/python/GrabzIt/GrabzItException.py index d611d5fe..0398d0eb 100644 --- a/python/GrabzIt/GrabzItException.py +++ b/python/GrabzIt/GrabzItException.py @@ -67,6 +67,7 @@ class GrabzItException(Exception): PARAMETER_INVALID_TRANSPARENT_VALUE = 170 PARAMETER_INVALID_ENCRYPTION_KEY = 171 PARAMETER_INVALID_NO_ADS = 172 + PARAMETER_INVALID_PROXY = 173 NETWORK_SERVER_OFFLINE = 200 NETWORK_GENERAL_ERROR = 201 NETWORK_DDOS_ATTACK = 202 diff --git a/python/GrabzIt/GrabzItImageOptions.py b/python/GrabzIt/GrabzItImageOptions.py index bb1e1cc9..d043dadc 100644 --- a/python/GrabzIt/GrabzItImageOptions.py +++ b/python/GrabzIt/GrabzItImageOptions.py @@ -80,5 +80,5 @@ def _getSignatureString(self, applicationSecret, callBackURL, url = ''): return applicationSecret +"|"+ urlParam + callBackURLParam + \ "|"+str(self.format)+"|"+str(int(self.height))+"|"+str(int(self.width))+"|"+str(int(self.browserHeight))+"|"+str(int(self.browserWidth))+"|"+str(self.customId)+ \ - "|"+str(int(self.delay))+"|"+str(self.targetElement)+"|"+str(self.customWaterMarkId)+"|"+str(int(self.requestAs))+"|"+str(self.country)+"|"+str(int(self.quality))+"|"+str(self.hideElement)+"|"+str(self.exportURL)+"|"+str(self.waitForElement)+"|"+str(int(self.transparent))+"|"+str(self.encryptionKey)+"|"+str(int(self.noAds))+"|"+str(self.post) + "|"+str(int(self.delay))+"|"+str(self.targetElement)+"|"+str(self.customWaterMarkId)+"|"+str(int(self.requestAs))+"|"+str(self.country)+"|"+str(int(self.quality))+"|"+str(self.hideElement)+"|"+str(self.exportURL)+"|"+str(self.waitForElement)+"|"+str(int(self.transparent))+"|"+str(self.encryptionKey)+"|"+str(int(self.noAds))+"|"+str(self.post)+"|"+str(self.proxy) \ No newline at end of file diff --git a/python/GrabzIt/GrabzItPDFOptions.py b/python/GrabzIt/GrabzItPDFOptions.py index e98035e6..f46e56c6 100644 --- a/python/GrabzIt/GrabzItPDFOptions.py +++ b/python/GrabzIt/GrabzItPDFOptions.py @@ -122,4 +122,4 @@ def _getSignatureString(self, applicationSecret, callBackURL, url = ''): "|"+str(int(self.marginLeft))+"|"+str(int(self.marginBottom))+"|"+str(int(self.marginRight))+"|"+str(int(self.delay))+"|"+str(int(self.requestAs))+ \ "|"+str(self.country)+"|"+str(int(self.quality))+"|"+str(self.templateId)+"|"+str(self.hideElement)+"|"+str(self.targetElement)+"|"+str(self.exportURL)+\ "|"+str(self.waitForElement)+"|"+str(self.encryptionKey)+"|"+str(int(self.noAds))+"|"+str(self.post)+"|"+str(int(self.browserWidth))+"|"+str(int(self.pageHeight))+\ - "|"+str(int(self.pageWidth))+"|"+str(self.templateVariables) \ No newline at end of file + "|"+str(int(self.pageWidth))+"|"+str(self.templateVariables)+"|"+str(self.proxy) \ No newline at end of file diff --git a/python/GrabzIt/GrabzItTableOptions.py b/python/GrabzIt/GrabzItTableOptions.py index f4f7b8d7..2a858977 100644 --- a/python/GrabzIt/GrabzItTableOptions.py +++ b/python/GrabzIt/GrabzItTableOptions.py @@ -57,5 +57,5 @@ def _getSignatureString(self, applicationSecret, callBackURL, url = ''): return applicationSecret +"|"+ urlParam + callBackURLParam + \ "|"+str(self.customId)+"|"+str(int(self.tableNumberToInclude))+"|"+str(int(self.includeAllTables))+"|"+str(int(self.includeHeaderNames))+"|"+str(self.targetElement)+ \ - "|"+str(self.format)+"|"+str(int(self.requestAs))+"|"+str(self.country)+"|"+str(self.exportURL)+"|"+str(self.encryptionKey)+"|"+str(self.post) + "|"+str(self.format)+"|"+str(int(self.requestAs))+"|"+str(self.country)+"|"+str(self.exportURL)+"|"+str(self.encryptionKey)+"|"+str(self.post)+"|"+str(self.proxy) \ No newline at end of file diff --git a/python/setup.py b/python/setup.py index 41bfd6fe..6f15c5be 100644 --- a/python/setup.py +++ b/python/setup.py @@ -3,7 +3,7 @@ from distutils.core import setup setup(name='GrabzIt', - version='3.2.6', + version='3.2.8', author='GrabzIt', author_email='support@grabz.it', url='https://grabz.it/api/python/',