Browse Source

HOT-FIX: Adiciona try/catch no Solr

pull/3304/head
Vinícius Cantuária 4 years ago
committed by eribeiro
parent
commit
0355abde55
  1. 10
      docker/solr_api.py

10
docker/solr_api.py

@ -27,9 +27,15 @@ class SolrClient:
def get_num_docs(self, collection_name):
final_url = self.QUERY_DATA.format(self.url, collection_name)
res = requests.get(final_url)
if res.ok:
try:
dic = res.json()
num_docs = dic["response"]["numFound"]
return num_docs
return dic["response"]["numFound"]
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)

Loading…
Cancel
Save