diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 176a458..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index ead2a65..0000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Lint - -on: [push, pull_request] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: psf/black@stable - with: - options: "--check --verbose" - src: "./solcast" - jupyter: false \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 2e731ab..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Docs - -on: - push: - branches: - - master - - main - -permissions: - contents: write - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: astral-sh/setup-uv@v4 - with: - python-version: "3.11" - - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - - uses: actions/cache@v4 - with: - key: uv-mkdocs-material-${{ env.cache_id }} - path: ~/.cache/uv - restore-keys: | - uv-mkdocs-material- - - - run: uv sync --group docs - - - run: uv run mkdocs gh-deploy --force diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml deleted file mode 100644 index cb24e47..0000000 --- a/.github/workflows/publish-to-pypi.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Publish 📦 to PyPI - -on: - push: - tags: - - "*" - -jobs: - build-and-publish: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v5 - - - name: Install uv - uses: astral-sh/setup-uv@v6 - - - name: Build a binary wheel and a source tarball - run: >- - uv - build - --sdist - --wheel - --out-dir dist/ - # - name: Publish distribution 📦 to Test PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 - # with: - # password: ${{ secrets.TEST_PYPI_API_TOKEN }} - # repository-url: https://test.pypi.org/legacy/ - - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 8040e8d..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Tests - -on: [push] - -jobs: - build: - strategy: - matrix: - os: ["ubuntu-latest", "macos-14", "windows-latest"] - python-version: ["3.8", "3.11"] - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v4 - - - name: Install dependencies with uv - run: | - uv python install ${{ matrix.python-version }} - uv sync --python ${{ matrix.python-version }} --extra all --all-groups - - - name: Test with pytest - env: - SOLCAST_API_KEY: ${{ secrets.SOLCAST_API_KEY }} - run: | - uv run --python ${{ matrix.python-version }} --group test pytest tests diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6d391e0..0000000 --- a/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -public -dist -uv.lock -.python-version -.idea -*.ipynb_checkpoints -.pytest_cache -tests/__pycache__ -*.pyc diff --git a/tests/__init__.py b/.nojekyll similarity index 100% rename from tests/__init__.py rename to .nojekyll diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index d969f96..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "python.testing.pytestArgs": ["tests"], - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true -} diff --git a/404.html b/404.html new file mode 100644 index 0000000..54523b4 --- /dev/null +++ b/404.html @@ -0,0 +1,1497 @@ + + + +
+ + + + + + + + + + + + + + + + + +
-
-# Solcast API Python SDK
-
-Python SDK to access the Solcast API
-
-[](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/docs.yml) [](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/test.yml) [](https://github.com/Solcast/solcast-api-python-sdk/actions/workflows/publish-to-pypi.yml)
-
----
-
-**Documentation**: https://solcast.github.io/solcast-api-python-sdk/
-
-## Install
-
-```commandline
-pip install solcast
-```
-
-or from source:
-
-```commandline
-git clone https://github.com/Solcast/solcast-api-python-sdk.git
-cd solcast-api-python-sdk
-pip install .
-```
-
-The base solcast sdk install requires only the python standard library.
-Pandas is the only optional dependency that adds functionality to the package.
-
-```commandline
-pip install solcast pandas
-```
-
-The example notebooks use a variety of optional dependencies to showcase different
-ways in which the Solcast API may be used. To install these dependencies run
-
-```commandline
-pip install solcast[all]
-```
-
-
-## Basic Usage
-
-```python
-from solcast import live
-
-res = live.radiation_and_weather(
- latitude=-33.856784,
- longitude=151.215297,
- output_parameters=['air_temp', 'dni', 'ghi']
-)
-res.to_dict()
-res.to_pandas() # requires optional pandas installation
-```
-
-Don't forget to set your [account Api Key](https://toolkit.solcast.com.au/register) with:
-`export SOLCAST_API_KEY={your commercial api_key}`
-
----
-
-## Contributing
-
-Tests are run against the Solcast API, you will need an API key to run them.
-They are executed on `unmetered locations` and as such won't consume your requests.
-
-```commandline
-pytest tests
-```
-
-## Docs
-
-From the directory run
-```bash
-mkdocs build
-mkdocs serve
-```
-In a browser navigate to `localhost:8000` to see the documentation.
-
-### Formatters and Linters
-
-| Language | Formatter/Linter |
-| -------- | ---------------- |
-| `yaml` | `yamlls` |
-| `toml` | `taplo` |
-| `python` | `black` |
-
-### Recommended Python Development Version
-
-Develop on the oldest supported `Python` version.
-
-```bash
-uv python pin 3.8
-```
diff --git a/aggregations/index.html b/aggregations/index.html
new file mode 100644
index 0000000..55b5778
--- /dev/null
+++ b/aggregations/index.html
@@ -0,0 +1,1674 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ More information in the API Docs.
+The module aggregations has 2 available methods:
| Endpoint | +API Docs | +
|---|---|
live |
+details | +
forecast |
+details | +
from solcast import aggregations
+
+res = aggregations.forecast(
+ collection_id="country_total",
+ aggregation_id="it_total",
+ output_parameters=['percentage', 'pv_estimate']
+)
+
+res.to_pandas().head()
+| period_end | +percentage | +pv_estimate | +
|---|---|---|
| 2024-06-13 04:30:00+00:00 | +1 | +333.499 | +
| 2024-06-13 05:00:00+00:00 | +3.6 | +1157.39 | +
| 2024-06-13 05:30:00+00:00 | +7 | +2268.41 | +
| 2024-06-13 06:00:00+00:00 | +10.4 | +3361.17 | +
| 2024-06-13 06:30:00+00:00 | +14.4 | +4630.91 | +
+
+
+
+ Handles all API get requests for the different endpoints.
+ + + + + + + + + +__init__(base_url, endpoint, response_type)
+
+Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ base_url
+ |
+
+ str
+ |
+
+
+
+ the base URL to Solcast API + |
+ + required + | +
+ endpoint
+ |
+
+ str
+ |
+
+
+
+ one of Solcast API's endpoints + |
+ + required + | +
delete(params)
+
+Wrap _make_request to make a DEL request
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ params
+ |
+
+ dict
+ |
+
+
+
+ a dictionary of parameters that are passed in the DEL request + |
+ + required + | +
Returns:
+| Type | +Description | +
|---|---|
+ Response
+ |
+
+
+
+ a Response object. + |
+
get(params)
+
+Wrap _make_request to make a GET request
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ params
+ |
+
+ dict
+ |
+
+
+
+ a dictionary of parameters that are passed in the GET request + |
+ + required + | +
Returns:
+| Type | +Description | +
|---|---|
+ Response
+ |
+
+
+
+ a Response object. + |
+
make_url()
+
+Compose the full URL.
+ +patch(params)
+
+Wrap _make_request to make a PATCH request
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ params
+ |
+
+ dict
+ |
+
+
+
+ a dictionary of parameters that are passed in the PATCH request + |
+ + required + | +
Returns:
+| Type | +Description | +
|---|---|
+ Response
+ |
+
+
+
+ a Response object. + |
+
post(params)
+
+Wrap _make_request to make a POST request
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ params
+ |
+
+ dict
+ |
+
+
+
+ a dictionary of parameters that are passed in the POST request + |
+ + required + | +
Returns:
+| Type | +Description | +
|---|---|
+ Response
+ |
+
+
+
+ a Response object. + |
+
put(params)
+
+Wrap _make_request to make a PUT request
+ + +Parameters:
+| Name | +Type | +Description | +Default | +
|---|---|---|---|
+ params
+ |
+
+ dict
+ |
+
+
+
+ a dictionary of parameters that are passed in the PUT request + |
+ + required + | +
Returns:
+| Type | +Description | +
|---|---|
+ Response
+ |
+
+
+
+ a Response object. + |
+
+
+
+
+
+ Bases: Response
Class to handle API response from the Solcast API for timeseries data.
+ + +Attributes:
+| Name | +Type | +Description | +
|---|---|---|
code |
+
+ int
+ |
+
+
+
+ HTTP status code of the response + |
+
url |
+
+ str
+ |
+
+
+
+ The URL that was requested + |
+
data |
+
+ Optional[bytes]
+ |
+
+
+
+ Raw response data as bytes + |
+
success |
+
+ bool
+ |
+
+
+
+ Whether the request was successful + |
+
method |
+
+ str
+ |
+
+
+
+ HTTP method used (GET, POST, etc.) + |
+
exception |
+
+ Optional[str]
+ |
+
+
+
+ Exception message if request failed + |
+
Examples:
+>>> response = Response(code=200, url="...", data=b"...", success=True, method="GET")
+>>> response.to_pandas()
+to_pandas()
+
+Return the data as a Pandas DataFrame with a DatetimeIndex.
+ +
+
+
+
+ Class to handle any API response from the Solcast API.
+ + +Attributes:
+| Name | +Type | +Description | +
|---|---|---|
code |
+
+ int
+ |
+
+
+
+ HTTP status code of the response + |
+
url |
+
+ str
+ |
+
+
+
+ The URL that was requested + |
+
data |
+
+ Optional[bytes]
+ |
+
+
+
+ Raw response data as bytes + |
+
success |
+
+ bool
+ |
+
+
+
+ Whether the request was successful + |
+
method |
+
+ str
+ |
+
+
+
+ HTTP method used (GET, POST, etc.) + |
+
exception |
+
+ Optional[str]
+ |
+
+
+
+ Exception message if request failed + |
+
Examples:
+>>> response = Response(code=200, url="...", data=b"...", success=True, method="GET")
+>>> response.to_dict()
+to_dict()
+
+Return the data as a dictionary.
+ +0&&i[i.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],s;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return i}function B(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o