Zip codes El Salvador
This Python package scrapes this web to get zip codes by municipality. It uses Requests with BeautifulSoup to extract that information, which is returned as a dict or JSON.
Install 🛠️
This package is in PIP, so you can install it as a dependency:
pip install zipcode-sv
How to use 🪐
from zipcode.department import Department, Endpoint
You have to import Department, which is the main class for scraping the zip codes. Endpoint is an Enum with El Salvador's departments to select from which one you want to get their municipalities with their zip codes.
# returns endpoint to extract data in web source
my_department = Endpoint.san_salvador.value
# scrapes web source to get municipalities with its zip codes
san_salvador_zipcodes = Department(my_department)
# returs a dict with municipalities and its zip codes
san_salvador_zipcodes.zip_codes
You must expect a dictionary like this.
{ "Aguilares":"01122",
"Apopa":"01123",
"Ayutuxtepeque":"01121",
"Delgado":"01118",
"Cuscatancingo":"01119",
"El Paisnal":"01124",
"Guazapa":"01125",
"Ilopango":"01117",
"Mejicanos":"01120",
"Nejapa":"01126",
"Panchimalco":"01127",
"Rosario de Mora":"01128",
"San Marcos":"01115",
"San Martín":"01129",
"San Salvador":"01101",
"Santiago Texacuangos":"01130",
"Santo Tomás":"01131",
"Soyapango":"01116",
"Tonacatepeque":"01132",
" ":" ",
"Summary":"San Salvador es un departamento fundado en 1525 ubicado en la Zona Central de El Salvador. Posee 3 distritos y 19 municipios."
}
Release files for zipcode-sv 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zipcode-sv-1.1.4.tar.gz | 16.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zipcode_sv-1.1.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 31.8 kB
Release files / zipcode-sv-1.1.4.tar.gz
| Download URL | zipcode-sv-1.1.4.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d2da058ae5ed0d3061c17f50341e9ca50863e786b7bd2131c839a8c11bd8fa7
|
|
BLAKE2b-256 checksum How to use checksums |
db3eb56cf60f5b419632b8917ebcb4406ee5611f3ef690d37c39eaa6b0eae299
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / zipcode_sv-1.1.4-py2.py3-none-any.whl
| Download URL | zipcode_sv-1.1.4-py2.py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
87d0cfade93ee3fb29c75a3b40434422614d74cecebd20b1932ba6fed39312e5
|
|
BLAKE2b-256 checksum How to use checksums |
cd5fb5d9f595bd05a4f0084009abb780d16ef5fbc5e55f2abaefff181de1b18b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|