Skip to content

Commit 9ab3847

Browse files
authored
Merge pull request #19 from ScrapingAnt/feature/residential_proxy_support
#18: residential proxies support
2 parents 98f6942 + 343018e commit 9ab3847

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ https://docs.scrapingant.com/request-response-format#available-parameters
5151
| url | <code>string</code> | |
5252
| cookies | <code>List[Cookie]</code> | None |
5353
| js_snippet | <code>string</code> | None |
54+
| proxy_type | <code>ProxyType</code> | datacenter |
5455
| proxy_country | <code>str</code> | None |
5556
| return_text | <code>boolean</code> | False |
5657
| wait_for_selector | <code>str</code> | None |
@@ -61,7 +62,7 @@ https://docs.scrapingant.com/request-response-format#available-parameters
6162
* * *
6263

6364
#### Cookie
64-
Class defining cookie. Curently supports only name and value
65+
Class defining cookie. Currently it supports only name and value
6566

6667
| Param | Type |
6768
| --- | --- |

scrapingant_client/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.3.6"
1+
__version__ = "0.3.7"
22

33
from scrapingant_client.client import ScrapingAntClient
44
from scrapingant_client.cookie import Cookie
@@ -10,11 +10,13 @@
1010
ScrapingantSiteNotReachableException,
1111
ScrapingantDetectedException,
1212
)
13+
from scrapingant_client.proxy_type import ProxyType
1314
from scrapingant_client.response import Response
1415

1516
__all__ = [
1617
'ScrapingAntClient',
1718
'Cookie',
19+
'ProxyType',
1820
'ScrapingantClientException',
1921
'ScrapingantInvalidTokenException',
2022
'ScrapingantInvalidInputException',

scrapingant_client/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
ScrapingantSiteNotReachableException,
1515
ScrapingantDetectedException,
1616
)
17+
from scrapingant_client.proxy_type import ProxyType
1718
from scrapingant_client.response import Response
1819
from scrapingant_client.utils import base64_encode_string
1920

@@ -34,6 +35,7 @@ def general_request(
3435
url: str,
3536
cookies: Optional[List[Cookie]] = None,
3637
js_snippet: Optional[str] = None,
38+
proxy_type: ProxyType = ProxyType.datacenter,
3739
proxy_country: Optional[str] = None,
3840
return_text: bool = False,
3941
wait_for_selector: Optional[str] = None,
@@ -45,6 +47,7 @@ def general_request(
4547
if js_snippet is not None:
4648
encoded_js_snippet = base64_encode_string(js_snippet)
4749
request_data['js_snippet'] = encoded_js_snippet
50+
request_data['proxy_type'] = proxy_type
4851
if proxy_country is not None:
4952
request_data['proxy_country'] = proxy_country.lower()
5053
if wait_for_selector is not None:

scrapingant_client/proxy_type.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from enum import Enum
2+
3+
4+
class ProxyType(str, Enum):
5+
datacenter = 'datacenter'
6+
residential = 'residential'

0 commit comments

Comments
 (0)