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 🛠️
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, ImageBingLimited
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. ImageBingLimited and ImageGoogle. ImageBing is an implementation of the official Bing Search Web API. The latter class (ImageBing) have implement cache (1 week) so you can be more efficient with your requests.
[!Note] ImageGoogle & ImageAzure 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.
# here ins't not needed use Endpoint Enum
my_department = "La Paz"
# return urls from Bing engine (Limited to 30 images)
bing_images:List[str] = ImageBingLimited(my_department).images
# return urls from Google engine
google_images:List[Dict[str]] = ImageGoogle(my_department,api_key).images
# return urls from official Bing engine (Limited to 100 images)
bing_images_api:List[str] = ImageBing(my_department,api_key,endpoint)
[!Note]
endpointparameter of ImageBing is necessary to specify that images are to be searched for. To search for another resource, another endpoint must be used. Check official documentation.
:bamboo: ~
Release files for souvenir-sv 2.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| souvenir_sv-2.1.5.tar.gz | 19.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| souvenir_sv-2.1.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 36.2 kB
Release files / souvenir_sv-2.1.5.tar.gz
| Download URL | souvenir_sv-2.1.5.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0cf17f43edcc01e932f5f763eef79d7ec49c956b244d179622a40815b9c98578
|
|
BLAKE2b-256 checksum How to use checksums |
644b4acf241156cef220ae434de06da67e10cc2106f66987c193e8e111bef8ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / souvenir_sv-2.1.5-py2.py3-none-any.whl
| Download URL | souvenir_sv-2.1.5-py2.py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
27dc3c76e67f63b24c414119b250ff91dc186036f9a7521feee30d32bbb397b6
|
|
BLAKE2b-256 checksum How to use checksums |
7a1040cea44398e0ed71f6a8b30472f77c5fc75fd686b18284aafc14bcd3f505
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|