Skip to content

Commit

Permalink
Merge pull request #17 from ScrapingAnt/feature/issue15-support-wait_…
Browse files Browse the repository at this point in the history
…for_selector-and-browser-params

feature/issue15-support-wait_for_selector-and-browser-params: done
  • Loading branch information
megabotan authored Aug 24, 2021
2 parents dca85cd + d59301d commit 98f6942
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ https://docs.scrapingant.com/request-response-format#available-parameters
| js_snippet | <code>string</code> | None |
| proxy_country | <code>str</code> | None |
| return_text | <code>boolean</code> | False |
| wait_for_selector | <code>str</code> | None |
| browser | <code>boolean</code> | True |

**IMPORTANT NOTE:** <code>js_snippet</code> will be encoded to Base64 automatically by the ScrapingAnt client library.

Expand Down
2 changes: 1 addition & 1 deletion scrapingant_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.3.5"
__version__ = "0.3.6"

from scrapingant_client.client import ScrapingAntClient
from scrapingant_client.cookie import Cookie
Expand Down
8 changes: 6 additions & 2 deletions scrapingant_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def general_request(
js_snippet: Optional[str] = None,
proxy_country: Optional[str] = None,
return_text: bool = False,
wait_for_selector: Optional[str] = None,
browser: bool = True,
) -> Response:
request_data = {'url': url}
if cookies is not None:
Expand All @@ -45,8 +47,10 @@ def general_request(
request_data['js_snippet'] = encoded_js_snippet
if proxy_country is not None:
request_data['proxy_country'] = proxy_country.lower()
if return_text:
request_data['return_text'] = True
if wait_for_selector is not None:
request_data['wait_for_selector'] = wait_for_selector
request_data['return_text'] = return_text
request_data['browser'] = browser

response = self.requests_session.post(
SCRAPINGANT_API_BASE_URL + '/general',
Expand Down

0 comments on commit 98f6942

Please sign in to comment.