Giter Club home page Giter Club logo

Comments (3)

MikeWang000000 avatar MikeWang000000 commented on June 3, 2024 1

#4 重复

如果您使用 Requests 库,请使用requests.Session()维持会话。

每隔一段时间,使用同一 session 向 api 发起请求。
当 cookie 临界过期时,会收到来自 api 的Set-Cookie 头部,包含新的 cookie,原 cookie 作废。
requests 库的 Session 会自动维护更新 cookie 值。

from golibcookie.

EJianZQ avatar EJianZQ commented on June 3, 2024

#4 重复

如果您使用 Requests 库,请使用requests.Session()维持会话。

每隔一段时间,使用同一 session 向 api 发起请求。 当 cookie 临界过期时,会收到来自 api 的Set-Cookie 头部,包含新的 cookie,原 cookie 作废。 requests 库的 Session 会自动维护更新 cookie 值。

也就是说我如果用别的语言和普通的post请求的话,是需要手动将set-cookie头部取出来的吗?

from golibcookie.

MikeWang000000 avatar MikeWang000000 commented on June 3, 2024

也就是说我如果用别的语言和普通的post请求的话,是需要手动将set-cookie头部取出来的吗?

是的。如果使用其他语言自行处理会话,需要严格按照服务器发来header中Set-Cookie的指示,调整下一次请求header中的Cookie值。

from golibcookie.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.