Skip to content

Commit

Permalink
HOT-FIX: Adiciona try/catch no Solr
Browse files Browse the repository at this point in the history
  • Loading branch information
cantuariavc authored and eribeiro committed Nov 23, 2020
1 parent 38e3146 commit 75beab0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docker/solr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ def __init__(self, url):
def get_num_docs(self, collection_name):
final_url = self.QUERY_DATA.format(self.url, collection_name)
res = requests.get(final_url)
dic = res.json()
num_docs = dic["response"]["numFound"]
return num_docs
try:
dic = res.json()
num_docs = dic["response"]["numFound"]
return num_docs
except Exception as e:
print(F"Erro no get_num_docs: {e}")
print(res.content)
return 0

def list_collections(self):
req_url = self.LIST_COLLECTIONS.format(self.url)
Expand Down

0 comments on commit 75beab0

Please sign in to comment.