File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77from .configuration import Configuration
88from .api_call import ApiCall
99from .analytics import Analytics
10+ from .stopwords import Stopwords
1011
1112class Client (object ):
1213 def __init__ (self , config_dict ):
@@ -19,3 +20,4 @@ def __init__(self, config_dict):
1920 self .analytics = Analytics (self .api_call )
2021 self .operations = Operations (self .api_call )
2122 self .debug = Debug (self .api_call )
23+ self .stopwords = Stopwords (self .api_call )
Original file line number Diff line number Diff line change 1+ from .stopwords_set import StopwordsSet
2+
3+
4+ class Stopwords (object ):
5+ RESOURCE_PATH = '/stopwords'
6+
7+ def __init__ (self , api_call ):
8+ self .api_call = api_call
9+ self .stopwords_sets = {}
10+
11+ def __getitem__ (self , stopwords_set_id ):
12+ if stopwords_set_id not in self .stopwords_sets :
13+ self .stopwords_sets [stopwords_set_id ] = StopwordsSet (self .api_call , stopwords_set_id )
14+
15+ return self .stopwords_sets .get (stopwords_set_id )
16+
17+ def upsert (self , stopwords_set_id , stopwords_set ):
18+ return self .api_call .put ('{}/{}' .format (Stopwords .RESOURCE_PATH , stopwords_set_id ), stopwords_set )
19+
20+ def retrieve (self ):
21+ return self .api_call .get ('{0}' .format (Stopwords .RESOURCE_PATH ))
Original file line number Diff line number Diff line change 1+ class StopwordsSet (object ):
2+ def __init__ (self , api_call , stopwords_set_id ):
3+ self .stopwords_set_id = stopwords_set_id
4+ self .api_call = api_call
5+
6+ def _endpoint_path (self ):
7+ from .stopwords import Stopwords
8+ return u"{0}/{1}" .format (Stopwords .RESOURCE_PATH , self .stopwords_set_id )
9+
10+ def retrieve (self ):
11+ return self .api_call .get (self ._endpoint_path ())
12+
13+ def delete (self ):
14+ return self .api_call .delete (self ._endpoint_path ())
You can’t perform that action at this time.
0 commit comments