Skip to content
Snippets Groups Projects
Commit 2798b110 authored by Iuri de Silvio's avatar Iuri de Silvio
Browse files

Merge pull request #62 from CodingForChange/fix_503_error

Lança 503 se acontece algum erro na chamada para os Correios na busca de CEP. Fix #61.
parents 02337ba9 52466374
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ class CepTracker():
'cepTemp': '',
'metodo': 'buscarCep'
})
response.raise_for_status()
return response.text
def _get_infos_(self, cep):
......
......@@ -2,7 +2,7 @@ import bottle
import json
from bottle import route, run, response
from CepTracker import CepTracker
from requests import ConnectionError
import requests
from correios import Correios
from database import MongoDb as Database
......@@ -42,7 +42,7 @@ def verifica_cep(cep):
except ValueError:
response.status = '404 O CEP %s informado nao pode ser localizado' % cep
return
except ConnectionError:
except requests.exceptions.RequestException:
response.status = '503 Servico Temporariamente Indisponivel'
return
for item in info:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment