kimmolinna / pycaruna Goto Github PK
View Code? Open in Web Editor NEWCaruna API for Python
License: MIT License
Caruna API for Python
License: MIT License
Hi,
pycaruna stopped working today after Caruna removed their good old Energiaseuranta section from their online service. The new Energiaseuranta is at the moment only displaying the consumption data in graph format only.
I just had a chat with Caruna customer service and they promised that their system should be updated with a new version "tomorrow or latest by the end of this week" which would contain the consumption data in numerical format (and as CSV).
Let's see what happens and how complex it will be to grab the consumption data from the new Energiaseuranta...
Cheers,
Markus
Which version on python this requires? I upgraded to 3.9 but I'm still getting error:
Traceback (most recent call last):
File "./pycaruna/pycaruna.py", line 5, in
def login_caruna (username: str,password: str|None):
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Hi,
Can you add a LICENSE file to the repository? I'd like to fork this and use it but technically it's proprietary at the moment, since you haven't specified a license at all.
Thanks!
Hi,
just have to ask, is this still working. Very new to python so before I bang my head to wrong table, please confirm :-)
Thanks for your work!
I started getting the following error about a week ago, maybe the caruna site has changed?
Traceback (most recent call last):
File "/Users/hannuteras/git/tuya/caruna/caruna.py", line 46, in
(session,info) = pycaruna.login_caruna(username, password)
File "/Users/hannuteras/git/tuya/caruna/pycaruna.py", line 50, in login_caruna
soup = BeautifulSoup(s.get(str(url)).content,'lxml')
File "/opt/homebrew/Caskroom/miniconda/base/envs/tuya/lib/python3.10/site-packages/requests/sessions.py", line 542, in get
return self.request('GET', url, **kwargs)
File "/opt/homebrew/Caskroom/miniconda/base/envs/tuya/lib/python3.10/site-packages/requests/sessions.py", line 515, in request
prep = self.prepare_request(req)
File "/opt/homebrew/Caskroom/miniconda/base/envs/tuya/lib/python3.10/site-packages/requests/sessions.py", line 443, in prepare_request
p.prepare(
File "/opt/homebrew/Caskroom/miniconda/base/envs/tuya/lib/python3.10/site-packages/requests/models.py", line 318, in prepare
self.prepare_url(url, params)
File "/opt/homebrew/Caskroom/miniconda/base/envs/tuya/lib/python3.10/site-packages/requests/models.py", line 392, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'e,chrome=1': No scheme supplied. Perhaps you meant http://e,chrome=1?
Hi,
I guess Caruna has made some changes in their end around 7 December 2022 which caused pycaruna to stop working.
The login method fails:
import pycaruna
session = pycaruna.login_caruna("my-username", "my-password")
Results in the following traceback...
Traceback (most recent call last):
File "/path/to/pycaruna/fetch.py", line 2, in <module>
session = pycaruna.login_caruna("my-username", "my-password")
File "/path/to/pycaruna/pycaruna.py", line 65, in login_caruna
r = s.get(url)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 528, in request
prep = self.prepare_request(req)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 456, in prepare_request
p.prepare(
File "/usr/lib/python3/dist-packages/requests/models.py", line 316, in prepare
self.prepare_url(url, params)
File "/usr/lib/python3/dist-packages/requests/models.py", line 390, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'e,chrome=1': No schema supplied. Perhaps you meant http://e,chrome=1?
Any ideas, anyone?
Cheers,
Markus
Sample code:
import pycaruna
session = pycaruna.login("username", "password")
customer = pycaruna.get_current(session)
metering_points = pycaruna.get_metering_points(session, customer)
consumption = pycaruna.get_cons_hours(session, customer, metering_point, "2022-11-01", "2022-11-30")
response = pycaruna.logout(session)
Issue1: 2nd row should be session = pycaruna.login**_caruna**...
Issue2:
Traceback (most recent call last):
File "/home/rhk/pycaruna_kimmolinna/rcaruna.py", line 5, in <module>
consumption = pycaruna.get_cons_hours(session, customer, metering_point, "2022-12-01", "2022-12-04")
NameError: name 'metering_point' is not defined. Did you mean: 'metering_points'?
changed to metering_points but got
Traceback (most recent call last):
File "/home/rhk/pycaruna_kimmolinna/rcaruna.py", line 5, in <module>
consumption = pycaruna.get_cons_hours(session, customer, metering_points, "2022-12-01", "2022-12-04")
File "/home/rhk/pycaruna_kimmolinna/pycaruna.py", line 122, in get_cons_hours
r=s.get("https://energiaseuranta.caruna.fi/api/meteringPoints/ELECTRICITY/"+metering_point+"/series?products=EL_ENERGY_CONSUMPTION&resolution=MONTHS_AS_HOURS&customerNumber="+customer+"&startDate="+start_day+"T00:00:00-0000&endDate="+end_day+"T00:00:00-0000")
TypeError: can only concatenate str (not "list") to str
Issue3: Last row should have pycaruna.logout**_caruna**(session)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.