Name | brazil-national-days JSON |
Version |
0.0.2
JSON |
| download |
home_page | None |
Summary | Is a package that simplifies accessing and managing Brazilian national holidays. It fetches holiday data directly from ANBIMA, allowing you to easily retrieve holiday dates, names, and weekdays, as well as check if a specific date is a holiday. The package offers a straightforward interface for querying and interacting with holiday information. |
upload_time | 2024-08-14 19:24:58 |
maintainer | None |
docs_url | None |
author | Leonardo Alves Francisco |
requires_python | None |
license | MIT License |
keywords |
holidays
brazil
national
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Brazil National Days
`brazil_national_days` is a package designed to simplify the retrieval and management of Brazilian national holidays. The package provides an easy-to-use interface for downloading, parsing, and querying holiday data directly from the ANBIMA website. This package can be used to check for national holidays, obtain the dates and names of holidays, and determine whether a specific date is a holiday.
## Installation
To install the package, you can use pip:
```bash
pip install brazil_national_days
```
## Use
Here is a basic example of how to use the brazil_national_days package:
### 1. Import the Package
```python
from brazil_national_days import Controller
```
### 2. Instantiate the Controller
```python
controller = Controller()
```
### 3. Use the Controller
```python
# Get all weekdays corresponding to national holidays
national_days = controller.get_national_days()
# Get all national holiday dates
national_dates = controller.get_national_dates()
# Get all national holiday names
national_holidays = controller.get_national_holidays()
# Get weekdays by a specific holiday name
holiday_name = "Carnaval"
holiday_days = controller.get_national_days_by_holiday(holiday_name)
# Get dates by a specific holiday name
holiday_dates = controller.get_national_dates_by_holiday(holiday_name)
# Check if a specific date is a holiday
date_to_check = "2024-02-12"
is_holiday = controller.is_holiday(date_to_check)
```
## Class and Method Details
### Clients
This class is used to fetch and prepare the holiday data.
#### Attributes:
* `URL (str)`: The URL to the ANBIMA Excel file containing the national holidays.
* `data (pd.DataFrame)`: A DataFrame that holds the processed holiday data.
#### Methods:
* `get_national_holidays() -> pd.DataFrame`: Downloads the Excel file from the provided URL, processes the data, and returns it as a pandas DataFrame. The dates are converted to `datetime.date` objects. If an error occurs during the request or parsing, the method handles the exceptions and returns `None`.
### Controller
This class provides methods to interact with the holiday data fetched by the Client.
#### Attributes:
* `__data (pd.DataFrame)`: A private attribute that stores the national holiday data fetched by the `Client`.
#### Methods:
* `get_national_days() -> list:` Returns a list of weekdays corresponding to all national holidays.
* `get_national_dates() -> list:` Returns a list of dates for all national holidays.
* `get_national_holidays() -> list:` Returns a list of names of all national holidays.
* `get_national_days_by_holiday(holiday: str) -> pd.Series:` Returns a Series of weekdays for a specific holiday.
* `get_national_dates_by_holiday(holiday: str) -> pd.Series:` Returns a Series of dates for a specific holiday.
* `is_holiday(date: Union[str, datetime.date]) -> bool:` Checks if a given date is a national holiday. Accepts both string `("YYYY-MM-DD")` and `datetime.date` objects.
## Error Handling
The package is designed to handle various errors, such as:
* Network issues when fetching the data.
* Parsing errors with the Excel file.
* Incorrect date formats when checking holidays.
## Contributing
If you'd like to contribute to this project, feel free to fork the repository, make changes, and submit a pull request. All contributions are welcome!
## License
MIT License
Copyright (c) [2024] [Leonardo Alves Francisco]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Raw data
{
"_id": null,
"home_page": null,
"name": "brazil-national-days",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "holidays brazil national",
"author": "Leonardo Alves Francisco",
"author_email": "leonardoalves294@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/62/f6/106c3447829bfffd602dc96f1b5cb18ebf65b604601a9895c31b8ddb28ac/brazil_national_days-0.0.2.tar.gz",
"platform": null,
"description": "\r\n# Brazil National Days\r\n\r\n`brazil_national_days` is a package designed to simplify the retrieval and management of Brazilian national holidays. The package provides an easy-to-use interface for downloading, parsing, and querying holiday data directly from the ANBIMA website. This package can be used to check for national holidays, obtain the dates and names of holidays, and determine whether a specific date is a holiday.\r\n## Installation\r\n\r\nTo install the package, you can use pip:\r\n\r\n```bash\r\n pip install brazil_national_days\r\n```\r\n \r\n## Use\r\n\r\nHere is a basic example of how to use the brazil_national_days package:\r\n\r\n### 1. Import the Package\r\n\r\n```python\r\nfrom brazil_national_days import Controller\r\n```\r\n\r\n### 2. Instantiate the Controller\r\n```python\r\ncontroller = Controller()\r\n```\r\n### 3. Use the Controller\r\n```python\r\n# Get all weekdays corresponding to national holidays\r\nnational_days = controller.get_national_days()\r\n\r\n# Get all national holiday dates\r\nnational_dates = controller.get_national_dates()\r\n\r\n# Get all national holiday names\r\nnational_holidays = controller.get_national_holidays()\r\n\r\n# Get weekdays by a specific holiday name\r\nholiday_name = \"Carnaval\"\r\nholiday_days = controller.get_national_days_by_holiday(holiday_name)\r\n\r\n# Get dates by a specific holiday name\r\nholiday_dates = controller.get_national_dates_by_holiday(holiday_name)\r\n\r\n# Check if a specific date is a holiday\r\ndate_to_check = \"2024-02-12\"\r\nis_holiday = controller.is_holiday(date_to_check)\r\n```\r\n## Class and Method Details\r\n\r\n### Clients\r\nThis class is used to fetch and prepare the holiday data.\r\n\r\n#### Attributes:\r\n* `URL (str)`: The URL to the ANBIMA Excel file containing the national holidays.\r\n* `data (pd.DataFrame)`: A DataFrame that holds the processed holiday data.\r\n#### Methods:\r\n* `get_national_holidays() -> pd.DataFrame`: Downloads the Excel file from the provided URL, processes the data, and returns it as a pandas DataFrame. The dates are converted to `datetime.date` objects. If an error occurs during the request or parsing, the method handles the exceptions and returns `None`.\r\n### Controller\r\nThis class provides methods to interact with the holiday data fetched by the Client.\r\n\r\n#### Attributes:\r\n* `__data (pd.DataFrame)`: A private attribute that stores the national holiday data fetched by the `Client`.\r\n#### Methods:\r\n* `get_national_days() -> list:` Returns a list of weekdays corresponding to all national holidays.\r\n* `get_national_dates() -> list:` Returns a list of dates for all national holidays.\r\n* `get_national_holidays() -> list:` Returns a list of names of all national holidays.\r\n* `get_national_days_by_holiday(holiday: str) -> pd.Series:` Returns a Series of weekdays for a specific holiday.\r\n* `get_national_dates_by_holiday(holiday: str) -> pd.Series:` Returns a Series of dates for a specific holiday.\r\n* `is_holiday(date: Union[str, datetime.date]) -> bool:` Checks if a given date is a national holiday. Accepts both string `(\"YYYY-MM-DD\")` and `datetime.date` objects.\r\n## Error Handling\r\n\r\nThe package is designed to handle various errors, such as:\r\n\r\n* Network issues when fetching the data.\r\n* Parsing errors with the Excel file.\r\n* Incorrect date formats when checking holidays.\r\n\r\n## Contributing\r\n\r\nIf you'd like to contribute to this project, feel free to fork the repository, make changes, and submit a pull request. All contributions are welcome!\r\n\r\n\r\n## License\r\n\r\nMIT License\r\n\r\nCopyright (c) [2024] [Leonardo Alves Francisco]\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Is a package that simplifies accessing and managing Brazilian national holidays. It fetches holiday data directly from ANBIMA, allowing you to easily retrieve holiday dates, names, and weekdays, as well as check if a specific date is a holiday. The package offers a straightforward interface for querying and interacting with holiday information.",
"version": "0.0.2",
"project_urls": null,
"split_keywords": [
"holidays",
"brazil",
"national"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "62f6106c3447829bfffd602dc96f1b5cb18ebf65b604601a9895c31b8ddb28ac",
"md5": "60082ec1f13d583ad031607da2ad4fd7",
"sha256": "c110a686286211f146f594e8f2b0e6cf0c34078e3444b20749b65c44e67899b8"
},
"downloads": -1,
"filename": "brazil_national_days-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "60082ec1f13d583ad031607da2ad4fd7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4166,
"upload_time": "2024-08-14T19:24:58",
"upload_time_iso_8601": "2024-08-14T19:24:58.315529Z",
"url": "https://files.pythonhosted.org/packages/62/f6/106c3447829bfffd602dc96f1b5cb18ebf65b604601a9895c31b8ddb28ac/brazil_national_days-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-14 19:24:58",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "brazil-national-days"
}