Skip to content

Commit 98f9c56

Browse files
Merge pull request #25 from outscraper/os-added-similarweb-company-website-finder
added similarweb, company website finder
2 parents b761e17 + 59cc6c2 commit 98f9c56

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

outscraper/api_client.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,3 +1255,67 @@ def trustpilot(self, query: Union[list, str], enrichment: list = None, fields: U
12551255
}, headers=self._api_headers)
12561256

12571257
return self._handle_response(response, async_request)
1258+
1259+
def similarweb(self, query: Union[list, str], fields: Union[list, str] = None, async_request: bool = False, ui: bool = None, webhook: str = None) -> Union[list, dict]:
1260+
'''
1261+
Similarweb
1262+
1263+
Returns data from Similarweb businesses.
1264+
1265+
Parameters:
1266+
query (str | list): Domains or websites (e.g., apple.com, https://www.google.com/). It supports batching by sending arrays with up to 250 queries (e.g., query=text1&query=text2&query=text3). It allows multiple queries to be sent in one request and to save on network latency time.
1267+
fields (str): The parameter defines which fields you want to include with each item returned in the response. By default, it returns all fields. Use &fields=query,name to return only the specific ones.
1268+
async_request (bool): defines the way you want to submit your task to Outscraper. It can be set to `False` to send a task and wait for the results, or `True` to submit a task and retrieve results later using a request ID with `get_request_archive`.
1269+
ui (bool): parameter defines whether a task will be executed as a UI task. This is commonly used when you want to create a regular platform task with API. Using this parameter overwrites the async_request parameter to `True`.
1270+
webhook (str): defines the callback URL to which Outscraper will send a POST request with JSON once the task is finished.
1271+
1272+
Returns:
1273+
list|dict: JSON result
1274+
1275+
See: https://app.outscraper.cloud/api-docs#tag/Domain-Related/paths/~1similarweb/get
1276+
'''
1277+
1278+
queries = as_list(query)
1279+
wait_async = async_request or len(queries) > 1
1280+
1281+
response = requests.get(f'{self._api_url}/similarweb', params={
1282+
'query': queries,
1283+
'fields': parse_fields(fields),
1284+
'async': wait_async,
1285+
'ui': ui,
1286+
'webhook': webhook
1287+
}, headers=self._api_headers)
1288+
1289+
return self._handle_response(response, async_request)
1290+
1291+
def company_websites_finder(self, query: Union[list, str], fields: Union[list, str] = None, async_request: bool = False, ui: bool = None, webhook: str = None) -> Union[list, dict]:
1292+
'''
1293+
Company Website Finder
1294+
1295+
Returns data from Company Website Finder businesses.
1296+
1297+
Parameters:
1298+
query (str | list): Business names (e.g., Apple Inc, Microsoft Corporation, Tesla Motors). It supports batching by sending arrays with up to 250 queries (e.g., query=text1&query=text2&query=text3). It allows multiple queries to be sent in one request and to save on network latency time
1299+
fields (str): TThe parameter defines which fields you want to include with each item returned in the response. By default, it returns all fields. Use &fields=query,name to return only the specific ones.
1300+
async_request (bool): defines the way you want to submit your task to Outscraper. It can be set to `False` to send a task and wait for the results, or `True` to submit a task and retrieve results later using a request ID with `get_request_archive`.
1301+
ui (bool): parameter defines whether a task will be executed as a UI task. This is commonly used when you want to create a regular platform task with API. Using this parameter overwrites the async_request parameter to `True`.
1302+
webhook (str): defines the callback URL to which Outscraper will send a POST request with JSON once the task is finished.
1303+
1304+
Returns:
1305+
list|dict: JSON result
1306+
1307+
See: https://app.outscraper.cloud/api-docs#tag/Domain-Related/paths/~1company-website-finder/get
1308+
'''
1309+
1310+
queries = as_list(query)
1311+
wait_async = async_request or len(queries) > 1
1312+
1313+
response = requests.get(f'{self._api_url}/company-website-finder', params={
1314+
'query': queries,
1315+
'fields': parse_fields(fields),
1316+
'async': wait_async,
1317+
'ui': ui,
1318+
'webhook': webhook
1319+
}, headers=self._api_headers)
1320+
1321+
return self._handle_response(response, async_request)

0 commit comments

Comments
 (0)