https://github.com/falsovsky/anavnet
Client library to the AnavNet website, which provides the current warnings from the Portuguese maritime ports
https://github.com/falsovsky/anavnet
beautifulsoup maritime ports portugal python requests warnings
Last synced: 7 months ago
JSON representation
Client library to the AnavNet website, which provides the current warnings from the Portuguese maritime ports
- Host: GitHub
- URL: https://github.com/falsovsky/anavnet
- Owner: falsovsky
- License: bsd-3-clause
- Created: 2018-08-26T04:36:18.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-28T21:48:42.000Z (about 7 years ago)
- Last Synced: 2025-02-22T03:45:25.320Z (8 months ago)
- Topics: beautifulsoup, maritime, ports, portugal, python, requests, warnings
- Language: Python
- Homepage: https://pypi.org/project/anavnet/
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AnavNet
Client library to the [AnavNet](http://anavnet.hidrografico.pt/AvisosLocais/AvisosLocais.aspx) website, which provides the current warnings from the Portuguese maritime ports.
* Includes all the available port names and identifiers.
* Counts the total messages per port.
* Extracts all the information from the messages.
* Includes a console script to consume the library.### Requirements
* [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/)
* [Requests](http://docs.python-requests.org/en/master/)### Installation
```sh
$ pip install anavnet
```### Usage
#### Library
```python
>>> from anavnet import AnavNet
>>> anavnet = AnavNet()
>>> anavnet.set_port(16)
>>> anavnet.get_total_messages()
>>> 12
>>> anavnet.get_message(1)
{'num_aviso': '288/18', 'dt_promulgacao': '23-Ago-2018', 'dt_inicio': '24-Ago-2018', 'dt_fim': '05-Set-2018', 'ent_promulgacao': 'Capitania do Porto de Lisboa - CAPIMARLISBOA', 'local': 'Rio Tejo - Cais Militar do Portinho da Costa.', 'assunto': 'Área interdita à navegação', 'descricao': 'No período de 24AGO a 05SET, está interdita a navegação a menos de 50 metros do Cais Militar do Portinho da Costa.', 'dt_cancelamento': 'Data de cancelamento: 05-Set-2018'}
```#### Console script:
```sh
$ anavclient --helpusage: anavclient [-h]
(--list | --total TOTAL | --text TEXT TEXT | --json JSON JSON)optional arguments:
-h, --help show this help message and exit
--list Lists available ports
--total TOTAL Gets the total of messages. Argument: PORT_ID
--text TEXT TEXT Get message as formatted text. Arguments: PORT_ID, MESSAGE_INDEX
--json JSON JSON Get message as JSON. Arguments: PORT_ID, MESSAGE_INDEX
```
### Tests```sh
$ python -m unittest discover -s tests
```License
----BSD-3-Clause