Skip to content

Commit

Permalink
Merge pull request #18 from SheffieldSolar/dev-addproxysupport
Browse files Browse the repository at this point in the history
Add support for proxy connections
Publish to PyPi
  • Loading branch information
JamieTaylor-TUOS authored May 2, 2023
2 parents 3adf116 + ebf6191 commit 09b527e
Show file tree
Hide file tree
Showing 52 changed files with 15,766 additions and 1,519 deletions.
17 changes: 3 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
FROM python:3.8
FROM python:3.10

WORKDIR /pv_live

COPY requirements.txt /pv_live/requirements.txt
RUN pip install --no-cache-dir pvlive-api > /dev/null

RUN apt-get -qq update && apt-get -qq install -y \
curl \
git \
wget \
> /dev/null

RUN pip install --no-cache-dir git+https://github.com/SheffieldSolar/[email protected] > /dev/null

#RUN pip install --no-cache-dir -r /pv_live/requirements.txt > /dev/null
#COPY . /pv_live/

CMD ["python", "/pv_live/pv_tracker.py", "-h"]
CMD ["pv_live", "-h"]
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# PV_Live
A Python implementation of the PV_Live web API. See https://www.solar.sheffield.ac.uk/pvlive/

**Latest Version: 0.12**
**Latest Version: 1.0.0**

**New! Updated 2022-07-19 to use the v4 PV_Live API.**
**New! Updated 2023-05-02 to provide support for proxy connections.**

## About this repository

* This Python library provides a convenient interface for the PV_Live web API to facilitate accessing PV_Live results in Python code.
* Developed and tested with Python 3.8, should work with Python 3.5+. Support for Python 2.7+ has been discontinued as of 2021-01-15.
* Developed and tested with Python 3.10, should work with Python 3.7+. Support for Python 2.7+ has been discontinued as of 2021-01-15.

## How do I get set up?

Expand Down Expand Up @@ -65,7 +65,7 @@ pvl = PVLive()
|Get the latest nationally aggregated GB PV outturn|`pvl.latest()`|`(0, '2021-01-20T11:00:00Z', 203.0)`|
|Get the latest aggregated outturn for **PES** region **23** (Yorkshire)|`pvl.latest(entity_id=23)`|`(23, '2021-01-20T14:00:00Z', 5.8833031)`
|Get the latest aggregated outturn for **GSP** ID **120** (INDQ1 or "Indian Queens")|`pvl.latest(entity_type="gsp", entity_id=120)`|`(120, '2021-01-20T14:00:00Z', 1, 3.05604)`
|Get the nationally aggregated GB PV outturn for all of 2020 as a DataFrame|`pvl.between(start=datetime(2020, 1, 1, 0, 30, tzinfo=pytz.utc), end=datetime(2021, 1, 1, tzinfo=pytz.utc), dataframe=True)`|![Screenshot of output](/misc/code_example_output.png?raw=true)|
|Get the nationally aggregated GB PV outturn for all of 2020 as a DataFrame|`pvl.between(start=datetime(2020, 1, 1, 0, 30, tzinfo=pytz.utc), end=datetime(2021, 1, 1, tzinfo=pytz.utc), dataframe=True)`|![Screenshot of output](https://raw.githubusercontent.com/SheffieldSolar/PV_Live-API/master/misc/code_example_output.png)|
|Get a list of GSP IDs|`pvl.gsp_ids`|`array([ 0, 1, 2, 3, ..., 336, 337, 338])`|
|Get a list of PES IDs|`pvl.pes_ids`|`array([ 0, 1, 2, 3, ..., 336, 337, 338])`|

Expand Down Expand Up @@ -96,27 +96,40 @@ This utility can be used to download data to a CSV file:

```
>> pv_live -h
usage: pvlive.py [-h] [-s "<yyyy-mm-dd HH:MM:SS>"] [-e "<yyyy-mm-dd HH:MM:SS>"] [--entity_type <entity_type>] [--entity_id <entity_id>]
[--period <5|30>] [-q] [-o </path/to/output/file>]
usage: pvlive.py [-h] [-s "<yyyy-mm-dd HH:MM:SS>"]
[-e "<yyyy-mm-dd HH:MM:SS>"] [--entity_type <entity_type>]
[--entity_id <entity_id>] [--period <5|30>] [-q]
[-o </path/to/output/file>] [-http <http_proxy>]
[-https <https_proxy>]
This is a command line interface (CLI) for the PV_Live API module
optional arguments:
-h, --help show this help message and exit
-s "<yyyy-mm-dd HH:MM:SS>", --start "<yyyy-mm-dd HH:MM:SS>"
Specify a UTC start date in 'yyyy-mm-dd HH:MM:SS' format (inclusive), default behaviour is to retrieve the latest outturn.
Specify a UTC start date in 'yyyy-mm-dd HH:MM:SS'
format (inclusive), default behaviour is to retrieve
the latest outturn.
-e "<yyyy-mm-dd HH:MM:SS>", --end "<yyyy-mm-dd HH:MM:SS>"
Specify a UTC end date in 'yyyy-mm-dd HH:MM:SS' format (inclusive), default behaviour is to retrieve the latest outturn.
Specify a UTC end date in 'yyyy-mm-dd HH:MM:SS' format
(inclusive), default behaviour is to retrieve the
latest outturn.
--entity_type <entity_type>
Specify an entity type, either 'gsp' or 'pes'. Default is 'pes'.
Specify an entity type, either 'gsp' or 'pes'. Default
is 'gsp'.
--entity_id <entity_id>
Specify an entity ID, default is 0 (i.e. national).
--period <5|30> Desired temporal resolution (in minutes) for PV outturn estimates. Default is 30.
--period <5|30> Desired temporal resolution (in minutes) for PV
outturn estimates. Default is 30.
-q, --quiet Specify to not print anything to stdout.
-o </path/to/output/file>, --outfile </path/to/output/file>
Specify a CSV file to write results to.
-http <http_proxy>, -http-proxy <http_proxy>
HTTP Proxy address
-https <https_proxy>, -https-proxy <https_proxy>
HTTPS Proxy address
Jamie Taylor, 2018-06-04
Jamie Taylor & Ethan Jones, 2018-06-04
```

## Using the Docker Image
Expand Down Expand Up @@ -177,4 +190,4 @@ In order to maintain a local copy of the PV_Live GB national outturn estimates t

## License

No license is defined yet - use at your own risk.
No license is defined yet - use at your own risk.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/modules.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: f978ded425e77db1cd389382a36d4599
config: c6c22792ba47f0e94e3b1e4c80b8abc3
tags: 645f666f9bcd5a90fca523b33c5a78b7
105 changes: 105 additions & 0 deletions docs/build/html/_modules/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &mdash; PV_Live API 1.0.0 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->

<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
</head>

<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >



<a href="../index.html" class="icon icon-home">
PV_Live API
</a>
<div class="version">
1.0.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../index.html">Welcome to PV_Live API’s documentation!</a></li>
<li class="toctree-l1"><a class="reference internal" href="../modules.html">Modules</a></li>
</ul>

</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">PV_Live API</a>
</nav>

<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Overview: module code</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<h1>All modules for which code is available</h1>
<ul><li><a href="pvlive_api/pvlive.html">pvlive_api.pvlive</a></li>
</ul>

</div>
</div>
<footer>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2018, Jamie Taylor.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.


</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>

</body>
</html>
Loading

0 comments on commit 09b527e

Please sign in to comment.