filcole / pycarwings2

Python library for interacting with the NissanConnect EV (aka CARWINGS) telematics service.
Apache License 2.0
33 stars 20 forks source link

Breaking changes that began December 22. #37

Closed Tobiaswk closed 2 years ago

Tobiaswk commented 2 years ago

I am the maintainer of dartcarwings and today December 22. something has changed in the API.

Calls to the UserLoginRequest.php always returns {status: 404, message: INVALID PARAMS}. I have decompiled the latest release 3.6.1 and I haven't been able to find the cause yet. The base URL is still https://gdcportalgw.its-mo.com/api_v210707_NE/gdc/.

Posting here to make people aware of the issue and possibly work together on a solution.

Tobiaswk commented 2 years ago

I've discovered the issue. The API now requires the User-Agent header to be present in requests.

filcole commented 2 years ago

Hi @Tobiaswk. Thanks for the info. I'm not seeing any issue here. It's still working without User-Agent.

Tobiaswk commented 2 years ago

Could it be the client you're using that automatically adds the User-Agent HTTP header?

Den 26. december 2021 17.16.45 CET, Phil Cole @.***> skrev:

Hi @Tobiaswk. Thanks for the info. I'm not seeing any issue here. It's still working without User-Agent.

-- Reply to this email directly or view it on GitHub: https://github.com/filcole/pycarwings2/issues/37#issuecomment-1001207125 You are receiving this because you were mentioned.

Message ID: @.***>

filcole commented 2 years ago

pycarwings2 is sending the following headers to https://gdcportalgw.its-mo.com/api_v210707_NE/gdc/ :

  'User-Agent': ''
  'Content-Length': '79'           <- variable
  'Content-Type': 'application/x-www-form-urlencoded'
Tobiaswk commented 2 years ago

That explains it then. If the User-Agent header is missing the API will fail with the body {status: 404, message: INVALID PARAMS}. If the User-Agent header is present but is containing an empty string it works without issues. Peculiar behavior but it makes sense now.

filcole commented 2 years ago

Thanks @Tobiaswk, thanks for the work on dartcarwings too.