Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-Hammo authored Jul 29, 2020
1 parent 90dc8f4 commit 8829e6c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arlulaapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def set_max_cloud(self, val):
def get_max_cloud(self):
return self.max_cloud

def filter_cloud(self, r):
def filter(self, r):
if r['supplier']=="" :
return False
return r['cloud']/self.max_cloud_vals.get(r["supplier"])*100<=self.max_cloud

def validate_creds(self):
Expand Down Expand Up @@ -117,7 +119,7 @@ def search(self,
if response.status_code != 200:
raise ArlulaSessionError(response.text)
else:
return [ArlulaObj(x) for x in json.loads(response.text) if self.filter_cloud(x)]
return [ArlulaObj(x) for x in json.loads(response.text) if self.filter(x)]

def gsearch(self,
params):
Expand All @@ -140,7 +142,7 @@ def gsearch(self,
response = grequests.map(searches, exception_handler=gsearch_exception)
result = []
for r in response:
result.append([ArlulaObj(x) for x in json.loads(r.text) if self.filter_cloud(x)])
result.append([ArlulaObj(x) for x in json.loads(r.text) if self.filter(x)])
return result

def get_order(self,
Expand Down

0 comments on commit 8829e6c

Please sign in to comment.