Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ https://docs.scrapingant.com/request-response-format#available-parameters
| url | <code>string</code> | |
| cookies | <code>List[Cookie]</code> | None |
| js_snippet | <code>string</code> | None |
| proxy_type | <code>ProxyType</code> | datacenter |
| proxy_country | <code>str</code> | None |
| return_text | <code>boolean</code> | False |
| wait_for_selector | <code>str</code> | None |
Expand All @@ -61,7 +62,7 @@ https://docs.scrapingant.com/request-response-format#available-parameters
* * *

#### Cookie
Class defining cookie. Curently supports only name and value
Class defining cookie. Currently it supports only name and value

| Param | Type |
| --- | --- |
Expand Down
4 changes: 3 additions & 1 deletion scrapingant_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.3.6"
__version__ = "0.3.7"

from scrapingant_client.client import ScrapingAntClient
from scrapingant_client.cookie import Cookie
Expand All @@ -10,11 +10,13 @@
ScrapingantSiteNotReachableException,
ScrapingantDetectedException,
)
from scrapingant_client.proxy_type import ProxyType
from scrapingant_client.response import Response

__all__ = [
'ScrapingAntClient',
'Cookie',
'ProxyType',
'ScrapingantClientException',
'ScrapingantInvalidTokenException',
'ScrapingantInvalidInputException',
Expand Down
3 changes: 3 additions & 0 deletions scrapingant_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
ScrapingantSiteNotReachableException,
ScrapingantDetectedException,
)
from scrapingant_client.proxy_type import ProxyType
from scrapingant_client.response import Response
from scrapingant_client.utils import base64_encode_string

Expand All @@ -34,6 +35,7 @@ def general_request(
url: str,
cookies: Optional[List[Cookie]] = None,
js_snippet: Optional[str] = None,
proxy_type: ProxyType = ProxyType.datacenter,
proxy_country: Optional[str] = None,
return_text: bool = False,
wait_for_selector: Optional[str] = None,
Expand All @@ -45,6 +47,7 @@ def general_request(
if js_snippet is not None:
encoded_js_snippet = base64_encode_string(js_snippet)
request_data['js_snippet'] = encoded_js_snippet
request_data['proxy_type'] = proxy_type
if proxy_country is not None:
request_data['proxy_country'] = proxy_country.lower()
if wait_for_selector is not None:
Expand Down
6 changes: 6 additions & 0 deletions scrapingant_client/proxy_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum


class ProxyType(str, Enum):
datacenter = 'datacenter'
residential = 'residential'