Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Agent problem again? #28

Closed
andbad opened this issue May 20, 2021 · 17 comments · Fixed by #29
Closed

User Agent problem again? #28

andbad opened this issue May 20, 2021 · 17 comments · Fixed by #29

Comments

@andbad
Copy link

andbad commented May 20, 2021

From this morning, the integration doesn't work anymore.
I delete the useragent from pycarwings2.py, at line 125, from:
headers={"User-Agent": "pycarwings2/2.10"}
to

headers={"User-Agent": ""}
and now works.

By(t)e

@MaxVandenbussche
Copy link

Hello, I had the same issue starting yesterday.
Removing the user-agent from the headers indeed solved the problem.

Thanks a lot!

@jymbob
Copy link

jymbob commented May 25, 2021

Well, that's annoying of them. Clearly an explicit change to make life harder for unofficial integrations. Can confirm that setting an empty string is working here.

@bwduncan
Copy link

That's extremely annoying. It seems like it fails with User-Agent "pycarwings2/2.0" but not "" or "Mozilla/5.0" so they are clearly upset at this use of the API. My leaf app did not stop working at the same time. Maybe someone should try to get in touch with Nissan and find out what has prompted this change?

@jmason
Copy link

jmason commented May 25, 2021

I can confirm this issue (and the fix). Is there any chance we could get a 2.11 release with the empty string User-Agent in the meantime?

@denilsonsa
Copy link

I wonder if we should just fake the exact User Agent that the official Nissan Leaf app also uses. That would probably future-proof it (or make it harder to detect). Or replace the User Agent with a message to the Nissan developers.

@jmason
Copy link

jmason commented May 27, 2021

@filcole I'd be happy to get a PR together if you like...

@andbad
Copy link
Author

andbad commented May 27, 2021

Or replace the User Agent with a message to the Nissan developers.

Ahaha, good idea. :-D

By(t)e

@jmason
Copy link

jmason commented Jun 1, 2021

Here's a PR: #29 . It just reverts back to sending an empty string, since I know that works, and I suspect Nissan will block any other identifiable User-Agent :(

@pnlrogue1
Copy link

@filcole Any chance of a merge? The PR is consistent with the discussion in this thread

@pnlrogue1
Copy link

Made the change proposed here and my app started running normally again

@staspika
Copy link

staspika commented Jun 18, 2021

How about, instead of hardcoding the user agent, let "pycarwings2/2.10" (or empty string, or whatever) be default in the library, but allow to override it from the user program?

@TomTorger
Copy link

Still experiencing this issue... I guess we have both a quick fix and a solution which will require a bit more coding?

@andbad
Copy link
Author

andbad commented Aug 10, 2021

Still experiencing this issue... I guess we have both a quick fix and a solution which will require a bit more coding?

At the moment I can't even log into the Nissan EV app. So, I think that the problem is in Nissan server, not in integration.

By(t)e

@jmason
Copy link

jmason commented Aug 10, 2021

At the moment I can't even log into the Nissan EV app. So, I think that the problem is in Nissan server, not in integration.

I have a locally-hacked HomeAssistant with my workaround in place and it has been reliably reporting charge levels from my car for several months (including this morning).

@TomTorger
Copy link

TomTorger commented Aug 10, 2021

Same here, works. :-)
However, I have to re-do the change every time I update my home assistant image... Could perhaps split the pycarwings directory out as a separate volume... Or sell the car. A lot of nice electric cars out there these days :-)

@DrGomek
Copy link

DrGomek commented Aug 10, 2021

I’m running a pretty stock rpi home assistant and don’t really know how to incorporate this fix into my environment.

I’m happy to take some coaching on doing so, but would be more interested in learning what it would take to get this “fix” incorporated into the main build.

@bwduncan
Copy link

@filcole I hope you are OK. It would be good to get this fixed in a more sustainable way, without having to fork this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants