Skip to main content

README

lgtm Alerts

code quality

travis-ci-badge

What is this repository for?

This python module gather the data by parsing the webpage. You will then be able to display the data on your dashboard or store it to your own database. I also provide code samples to better explain this -see directory ‘samples’-.

How do I get set up?

To ensure a proper setup, I recommend the use of virtualenv (but optionnal).

sudo pip install cavelink

Then you can use the module that way:

from cavelink import cavelink as cl

webpage="http://www.cavelink.com/cl/da.php?s=142&g=10&w=1&l=10"
nb_rows = 5

cavelink = cl.Sensor(webpage, nb_rows)
motiers = cavelink.getJSON(datefmt='human')  # or datefmt='epoch'

print(motiers)

You will get a the measurements and the sensor details formatted in JSON.

{
   "measures": {
      "22.12.2018 16:00": 6.3,
      "22.12.2018 16:30": 5.67,
      "22.12.2018 17:00": 6.0,
      "22.12.2018 17:30": 5.45,
      "22.12.2018 18:00": 5.87
   },
   "sensor": {
      "group": "10",
      "number": "1",
      "station": "142",
      "unit": "C"
   }
}

You can also fetch additionnal information, also available from the page. Please note that the following data is provided in JSON object as well. This is:

>>> print(cavelink.station)
>>> print(cavelink.group)
>>> print(cavelink.number)
>>> print(cavelink.unit)

To parse the measures, you can use this sample:

import json

# convert the json-formatted string to a python dictionnay
motiers_json = json.loads(motiers)

# parse measures
for timestamp in motiers_json['measures']:
   print('%s -> %s %s' % (timestamp,
                        motiers_json['measures'][timestamp],
                        motiers_json['sensor']['unit']))

Contribution guidelines

Feel free to submit issue or better, some pull requests !

Contributors

Who do I talk to?

sebastien at pittet dot org

Metadata

Release files for cavelink 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cavelink 1.1.2
File Size Uploaded Provenance Actions
cavelink-1.1.2.tar.gz 5.2 kB Without provenance Details for cavelink-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cavelink 1.1.2
File Interpreter ABI Platform Actions
cavelink-1.1.2-py3-none-any.whl Python 3 none any Details for cavelink-1.1.2-py3-none-any.whl

Total release size: 11.4 kB

Security for cavelink 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page