Skip to content

Commit e72a668

Browse files
DataUrbanEconGeekRosa
andauthored
Add glassdoor reviews (#19)
Co-authored-by: Rosa <[email protected]>
1 parent 4b65030 commit e72a668

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

outscraper/api_client.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,3 +890,41 @@ def trustpilot_reviews(self, query: Union[list, str], limit: int = 100, language
890890
}, headers=self._api_headers)
891891

892892
return self._handle_response(response, wait_async, async_request)
893+
894+
def glassdoor_reviews(self, query: Union[list, str], limit: int = 100, sort: str = 'DATE',
895+
cutoff: int = None, fields: Union[list, str] = None, async_request: bool = False, ui: bool = None,
896+
webhook: str = None
897+
) -> list:
898+
'''
899+
Returns reviews from Glassdoor companies.
900+
901+
Parameters:
902+
query (list | str): Direct links to any Glassdoor company (e.g., 'https://www.glassdoor.com/Reviews/Amazon-Reviews-E6036.htm). Using a lists allows multiple queries (up to 250) to be sent in one request and save on network latency time.
903+
limit (int): parameter specifies the limit of reviews to get from one query.
904+
sort (str): parameter specifies one of the sorting types. Available values: "DATE", "RELEVANCE".
905+
cutoff (int): parameter specifies the oldest timestamp value for items. Using the cutoff parameter overwrites sort parameter. Therefore, the latest records will be at the beginning (newest first).
906+
fields (list | str): parameter defines which fields you want to include with each item returned in the response. By default, it returns all fields.
907+
async_request (bool): parameter defines the way you want to submit your task to Outscraper. It can be set to `False` (default) to send a task and wait until you got your results, or `True` to submit your task and retrieve the results later using a request ID with `get_request_archive`. Each response is available for `2` hours after a request has been completed.
908+
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`.
909+
910+
Returns:
911+
list: json result
912+
913+
See: https://app.outscraper.com/api-docs#tag/Others/paths/~1glassdoor~1reviews/get
914+
'''
915+
916+
queries = as_list(query)
917+
wait_async = async_request or limit > 499 or len(queries) > 10
918+
919+
response = requests.get(f'{self._api_url}/glassdoor/reviews', params={
920+
'query': queries,
921+
'limit': limit,
922+
'sort': sort,
923+
'cutoff': cutoff,
924+
'async': wait_async,
925+
'fields': parse_fields(fields),
926+
'ui': ui,
927+
'webhook': webhook,
928+
}, headers=self._api_headers)
929+
930+
return self._handle_response(response, wait_async, async_request)

0 commit comments

Comments
 (0)