chrisglencross / scrape-solarman

Scrapes solar power data from the Solarman web site at https://home.solarman.cn/ and writes data to an InfluxDB time series database.
3 stars 0 forks source link

KeyError: 'client_id' #2

Open alexzerabr opened 5 months ago

alexzerabr commented 5 months ago

Traceback (most recent call last): File "/root/scrape-solarman/solarman-scraper.py", line 329, in main() File "/root/scrape-solarman/solarman-scraper.py", line 293, in main scraper = SolarmanScraper(config) ^^^^^^^^^^^^^^^^^^^^^^^ File "/root/scrape-solarman/solarman-scraper.py", line 245, in init self.solarman = SolarmanClient(solarman_config["login"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/scrape-solarman/solarman-scraper.py", line 62, in init self.auth_headers = self.headers | {"Authorization": f"Bearer {self.login()}"} ^^^^^^^^^^^^ File "/root/scrape-solarman/solarman-scraper.py", line 67, in login f"{SOLARMAN_API}/account/v1.0/token?appId={self.login_config['client_id']}&language=en",


KeyError: 'client_id'

When I run python3.11 solarman-scraper.py, it returns this error, can you tell me why? 
![Screenshot 2024-01-23 171107](https://github.com/chrisglencross/scrape-solarman/assets/63591836/70e8d8ef-9893-431f-b6ee-6d294176784f)
chrisglencross commented 5 months ago

Sorry, for the slow response. Until just now the example configuration file https://github.com/chrisglencross/scrape-solarman/blob/master/solarman-scraper-sample.yml included an from the previous version of the Solarman API, which now requires a client id and client token. I've updated it.

Solarman customer services were able to provide the client id and token after asking a few questions to confirm it was for personal use.

alexzerabr commented 5 months ago

I asked through Solarman customer services and it took them a few days to get back to me, and they also questioned my use.

Once I had the ID and Secret, I had an error related to the email, which I just had to change the user: field to email:.

Now it's working.

Thank you very much!