@@ -38,9 +38,7 @@ def check_service_status(self):
3838 pass
3939
4040 def send (self , query_object ):
41-
42- # if (isinstance(query_object, query.Query) or query_object is None):
43- # raise SendError("The object you are attempting to send is not a valid query object")
41+ """Sends a instantiated query object, returns a list of dicts"""
4442
4543 if isinstance (query_object , query .FullTextSearch ):
4644 self .endpoint = self .endpoint_full_text
@@ -85,6 +83,7 @@ def send(self, query_object):
8583 raise SendError ("The object you are attempting to send is not a valid query object" )
8684
8785 def get_default_page (self ):
86+ """Get the first page of any given request, return results as json object"""
8887 r = requests .post (url = self .endpoint , headers = self .headers , data = json .dumps (self .payload ))
8988 self .parse_response_codes (r , self .debug )
9089 results = r .json ()
@@ -95,6 +94,7 @@ def get_default_page(self):
9594 return results
9695
9796 def get_all_pages (self ):
97+ """Gets the 2nd page and all subsequent pages of a given response, returns all pages as json object"""
9898 pages = []
9999
100100 first_page = self .get_default_page ()
@@ -111,6 +111,7 @@ def get_all_pages(self):
111111 return pages
112112
113113 def pages_to_assets (self ,pages ):
114+ """Converts all json object pages to a pythonic list of dicts"""
114115 assets = []
115116 # print(pages)
116117 for page in pages :
@@ -120,6 +121,7 @@ def pages_to_assets(self,pages):
120121 return assets
121122
122123 def parse_response_codes (self , response , debug ):
124+ """Parses the reponse code and raises a APIConnection error if not 200"""
123125 if response .status_code == 200 :
124126 if debug :
125127 print ("Request successful" )
0 commit comments