https://github.com/dschep/pycocorahs
a Python package providing a CLI utility and an API for uploading observations to CoCoRaHS
https://github.com/dschep/pycocorahs
Last synced: 11 months ago
JSON representation
a Python package providing a CLI utility and an API for uploading observations to CoCoRaHS
- Host: GitHub
- URL: https://github.com/dschep/pycocorahs
- Owner: dschep
- License: gpl-3.0
- Created: 2020-09-30T14:31:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-30T19:05:06.000Z (over 5 years ago)
- Last Synced: 2025-02-20T06:47:46.378Z (12 months ago)
- Language: Python
- Size: 15.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyCoCoraHS
PyCoCoraHS is a Python package providing a CLI utility and an API for uploading observations to
[CoCoRaHS](https://cocorahs.org).
## Installing
Install this package using `pip`:
```shell
python3 -m pip install --user cocorahs
```
## Using the CLI
You can invoke the CLI via `cocorahs`. Here is the help output:
```
Usage: cocorahs [OPTIONS] PERCIPITATION
Report PERCIPITATION amount to CoCoRaHS. Enter T for trace amounts.
Options:
--station TEXT The CoCoRaHS station code
--username TEXT Your CoCoRaHS username
--password TEXT Your CoCoRaHS password
--help Show this message and exit.
```
### Configuring the CLI via a config file.
Create a file at `~/.config/cocorahs/config.ini` containing a config like the following but
changing the details to your username, password, & station.
```ini
[CoCoRaHS]
username = DanielSchep
password = hunter2
station = VA-RCC-15
```
## API Usage
Here is a simple example of making a new report via the API:
```python
from cocorahs import CoCoRaHS
api = CoCoRaHS(username='DanielSchep', password='hunter2')
api.new_report(station='VA-RCC-15', percipitation=0.1, trace=False)
```
The `new_report` function also accepts an `observation_time` keyword argument. It should be a
`datetime.datetime` object.