Skip to content

Commit 944f8ef

Browse files
author
Reed Jessen
committed
added docstring to all methods.
1 parent 4e6bc49 commit 944f8ef

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

IPStreet/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)