adafruit / Adafruit_CircuitPython_Requests

Requests-like interface for web interfacing
MIT License
51 stars 37 forks source link

Can't keep the session like in requests in Cpython #137

Closed chechigp closed 1 year ago

chechigp commented 1 year ago

I'm trying to login and get some data from an api, I tried with the request library in Cpython and works well.

  1. Create a session object
  2. Post the login data with the session method
  3. Get the api data with the session method

But when I tried with circuitpython and this library I cant get the api data (3) because it redirect me to the login page. I think there are some redirects in the point 3 as I can see in postman

There is any limitation or feature that I'm missing? I can share the code if it's needed.

Thanks for your time

tannewt commented 1 year ago

I suspect the post is setting a cookie but adafruit_requests doesn't manage cookies for you. So, it's a missing feature of normal requests.

chechigp commented 1 year ago

I suspect the post is setting a cookie but adafruit_requests doesn't manage cookies for you. So, it's a missing feature of normal requests.

I figured that was the case. Finally I managed the cookies manually. Thanks for your response!