BrazilCEP is the successor to PyCEPCorreios. To migrate, follow these three steps:
- Update Imports: Change
import pycepcorreios to import brazilcep. - Update Result Keys: The keys in the returned dictionary have been translated from Portuguese to English.
bairro $\rightarrow$ districtcidade $\rightarrow$ citylogradouro $\rightarrow$ streetcomplemento $\rightarrow$ complementcep and uf remain the same.
- Remove
BaseException usage: The BaseException that was present in the old library has been removed.
### Step 1: Update Imports
# Old
import pycepcorreios
# New
import brazilcep
### Step 2: Adjust Keys
# Old format
{
'bairro': 'rua abc',
'cep': '37503130',
'cidade': 'city ABC',
'logradouro': 'str',
'uf': 'str',
'complemento': 'str',
}
# New format
{
'district': 'rua abc',
'cep': '37503130',
'city': 'city ABC',
'street': 'str',
'uf': 'str',
'complement': 'str',
}