Skip to main content

Public holidays in Spain from 2006 to now

Project description

A small Python package to obtain the public holidays in Spain from 2006 to the current year. This application uses the web scraping technique to obtain the data from calendarioslaborales.net

Made with Python with ❤️

Package:
Python supported versions PyPI version Downloads
CI/CD:
https://github.com/rsolanodev/holidays-es/actions/workflows/action-push-develop.yml/badge.svg
Meta:
Code style License

Install

Install via pip:

$ pip install holidays-es

Quick Start

  1. Import the HolidaySpain class and set the province and year of the holidays you want to obtain.

from datetime import date
from holidays_es import Province, HolidaySpain, Scope

holiday_spain = HolidaySpain(province=Province.VALENCIA, year=2022)

holiday_date = date(day=1, month=1, year=2022)
expected_holiday = models.Holiday(
    scope=Scope.NATIONAL,
    date=holiday_date,
    description="Año nuevo",
)

assert expected_holiday == holiday_spain.find(date=holiday_date)
  1. If you only need the national, regional, or local holidays, you can also obtain them in the following way:

from holidays_es import Province, HolidaySpain

holiday_spain = HolidaySpain(province=Province.MADRID, year=2020)

for holiday in holiday_spain.national:
    holiday.scope  # <Scope.NATIONAL: 'national'>
    holiday.date  # datetime.date(2023, 1, 1)
    holiday.description  # Año nuevo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

holidays_es-2.0.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

holidays_es-2.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file holidays_es-2.0.0.tar.gz.

File metadata

  • Download URL: holidays_es-2.0.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.7 Darwin/22.6.0

File hashes

Hashes for holidays_es-2.0.0.tar.gz
Algorithm Hash digest
SHA256 68b1b9a1bb652bb892b6c5d809985bdace0a2a3b5aab6b60f9af2e9db20f4ad7
MD5 65dce9d0fc0de84df5cd2773772f4ab8
BLAKE2b-256 2e0a257e0b53673e72573f646628c76b2a653594e9e2fe202a288d0c1b185813

See more details on using hashes here.

File details

Details for the file holidays_es-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: holidays_es-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.7 Darwin/22.6.0

File hashes

Hashes for holidays_es-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c550171df204fc118cc0ef8105929668109468e5c0ca4960240f4b1e2a23e3e6
MD5 079969bb7e0f870a3265255a73f23718
BLAKE2b-256 e20a6becdcf39a6ac5049c170354396f576d00066cc0575f37a85e498ca57f06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page