Skip to content

Commit 4c61407

Browse files
author
himanshu
committed
added validation
1 parent e5b75f1 commit 4c61407

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

newsdataapi/newsdataapi_client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ def latest_api(
350350
'url':url,
351351
'sort':sort
352352
}
353+
if scroll and paginate:
354+
raise NewsdataException("Both 'scroll' and 'paginate' cannot be True at the same time.")
355+
353356
URL_parameters = self.__validate_parms(user_param=params)
354357
if scroll:
355358
return self.__get_feeds_all(endpoint=self.latest_url,query_params=URL_parameters,max_result=max_result)
@@ -421,6 +424,9 @@ def archive_api(
421424
'url':url,
422425
'sort':sort
423426
}
427+
if scroll and paginate:
428+
raise NewsdataException("Both 'scroll' and 'paginate' cannot be True at the same time.")
429+
424430
URL_parameters = self.__validate_parms(user_param=params)
425431
if scroll:
426432
return self.__get_feeds_all(endpoint=self.archive_url,query_params=URL_parameters,max_result=max_result)
@@ -522,6 +528,9 @@ def crypto_api(
522528
'url':url,
523529
'sort':sort
524530
}
531+
if scroll and paginate:
532+
raise NewsdataException("Both 'scroll' and 'paginate' cannot be True at the same time.")
533+
525534
URL_parameters = self.__validate_parms(user_param=params)
526535
if scroll:
527536
return self.__get_feeds_all(endpoint=self.crypto_url,query_params=URL_parameters,max_result=max_result)
@@ -661,6 +670,9 @@ def market_api(
661670
'symbol': symbol,
662671
'country': country
663672
}
673+
if scroll and paginate:
674+
raise NewsdataException("Both 'scroll' and 'paginate' cannot be True at the same time.")
675+
664676
URL_parameters = self.__validate_parms(user_param=params)
665677
if scroll:
666678
return self.__get_feeds_all(endpoint=self.market_url,query_params=URL_parameters,max_result=max_result)

0 commit comments

Comments
 (0)