A package to get zipcodes from El Salvador departments
Project description
El Salvador souvenir
This Python package scrapes this web to get zip codes by municipality. It uses Requests
with BeautifulSoup
to extract that information, which is then returned as a dictionary or JSON.
Install 🛠️
This package can be installed with PIP as a dependency:
pip install souvenir-sv
How to use 🪐
# for department/municipalities zip-codes scraper
from souvenir.zipcode import Endpoint, Zipcode
# for department images scraper
from souvenir.image import ImageBing, ImageGoogle
ImageGoogle scraper requires an API Key to work, which means that you have to sign in on the author's package website to get access to the scraper. ImageBing does not need it.
Zip-codes:
# return endpoint to extract data in web source
my_department:str = Endpoint.san_salvador.value
# scrapes web source to get municipalities with its zip codes
san_salvador_zipcodes:object = Zipcode(my_department)
# retur 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."
}
Images:
You can check package's documentation from author's repositories. ImageBing and ImageGoogle.
# this step is shared with Zipcode class to choice which department scrape
my_department:str = Endpoint.san_salvador.value
# return urls from Bing engine
bing_images:List[str] = ImageBing(my_department).images
# return urls from Google engine
google_images:List[str] = ImageBIng(my_department,api_key).images
Enjoy :bamboo:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
souvenir-sv-2.0.2.tar.gz
(18.4 kB
view hashes)
Built Distribution
Close
Hashes for souvenir_sv-2.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94b6f6285efe0b94c9df3812213f8a1e45531009400ebc6d9d78d32f88f0ed7a |
|
MD5 | 5dd8f8067d18416422ccd950f6574c98 |
|
BLAKE2b-256 | 1da93f2b50460079db60bad4fbab2b656d1abb69cc7db454669068d8c3acc823 |