44from typing import Optional ,Union
55from datetime import datetime ,timezone
66from urllib .parse import urlencode , quote
7+ from newsdataapi .helpers import FileHandler
78from requests .exceptions import RequestException
89from newsdataapi .newsdataapi_exception import NewsdataException
910
10- class NewsDataApiClient :
11+ class NewsDataApiClient ( FileHandler ) :
1112
1213 def __init__ (
1314 self , apikey :str , session :bool = False , max_retries :int = constants .DEFAULT_MAX_RETRIES , retry_delay :int = constants .DEFAULT_RETRY_DELAY ,
14- proxies :Optional [dict ]= None , request_timeout :int = constants .DEFAULT_REQUEST_TIMEOUT ,max_result :int = 10 ** 10 , debug :Optional [bool ]= False
15+ proxies :Optional [dict ]= None , request_timeout :int = constants .DEFAULT_REQUEST_TIMEOUT ,max_result :int = 10 ** 10 , debug :Optional [bool ]= False ,
16+ folder_path :str = None
1517 ):
1618 """Initializes newsdata client object for access Newsdata APIs."""
1719 self .apikey = apikey
@@ -22,6 +24,7 @@ def __init__(
2224 self .proxies = proxies
2325 self .request_timeout = request_timeout
2426 self .is_debug = debug
27+ super ().__init__ (folder_path = folder_path )
2528
2629 def set_retries ( self , max_retries :int , retry_delay :int )-> None :
2730 """ API maximum retry and delay"""
@@ -160,7 +163,7 @@ def news_api(
160163 Sending GET request to the news api.
161164 For more information about parameters and input, Please visit our documentation page: https://newsdata.io/documentation
162165 """
163- warn ('This method is deprecated and will be removed in upcomming updates, Instead use latest_api()' , DeprecationWarning , stacklevel = 2 )
166+ warn ('This method is deprecated and will be removed in upcoming updates, Instead use latest_api()' , DeprecationWarning , stacklevel = 2 )
164167 params = {
165168 'apikey' :self .apikey ,'q' :q ,'qInTitle' :qInTitle ,'country' :country ,'category' :category ,'language' :language ,'domain' :domain ,'timeframe' :str (timeframe ) if timeframe else timeframe ,
166169 'size' :size ,'domainurl' :domainurl ,'excludedomain' :excludedomain ,'timezone' :timezone ,'full_content' :full_content ,'image' :image ,'video' :video ,'prioritydomain' :prioritydomain ,
0 commit comments