Skip to content

Commit ac69c88

Browse files
committed
docs: add example for quarterly resolution price info
1 parent 72d05aa commit ac69c88

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,22 @@ def when_to_stop(data):
151151
# If a user agent was not defined earlier, this will be required here
152152
home.start_live_feed(user_agent = "UserAgent/0.0.1", exit_condition = when_to_stop)
153153
```
154+
155+
### Getting quarter hourly price information
156+
157+
```python
158+
import tibber
159+
160+
account = tibber.Account(tibber.DEMO_TOKEN)
161+
subscription = account.homes[0].current_subscription
162+
163+
# The API requires the date to be passed as a base64 encoded string with timezone information
164+
date = datetime.datetime(2025, 1, 1, 0, 0, 0)
165+
encoded_date = base64.b64encode(date.astimezone().isoformat().encode("utf-8")).decode("utf-8")
166+
167+
# QUARTER_HOURLY, HOURLY or DAILY
168+
connection = subscription.fetch_price_info_range("QUARTER_HOURLY", first=10, after=encoded_date)
169+
170+
connection.nodes # A list of Price objects
171+
```
172+

0 commit comments

Comments
 (0)