Addons development: how does Python handle cookies?



I didn’t find any location dedicated to addon development (is there any?).

Anyway, I need some help as I’m making circles since a few weeks now, working on Orange TV France for Kodi. No need to be in France or use Orange to understand this problem.

I’m working on a feature to allow people to use their Orange credentials so then can access TV when they’re not at home. This is possible using both their mobile app and their website, so it should be doable. As for the rest of this addon, I’m replicating the behaviour of a web browser in order to do so. There’re basically for steps:

  1. Load login page
  2. Post user email
  3. Post user password
  4. Retrieve auth token

Quite easy, but there is a trick: each call sends back a token I have to include in the next one as a cookie. As I’m more fluent in JS, I made a prototype with and I’m able to get the final auth token. So, that’s scriptable. But I’m stuck with Kodi Python. Step 2 call keeps responding with 412. I ran a few tests and I’m able to reproduce that issue with Postman and JS: cookie is set in step 2 call, but the value is wrong.

I tried everything I could think of: cookie set into the headers, cookie set using HTTPCookieProcessor and CookieJar, etc. Result is still the same. What am I missing?