Module grab.cookie¶

This module contains some classes to work with cookies.

grab.cookie.create_cookie(name, value, domain, httponly=None, **kwargs)[source]¶

Creates cookielib.Cookie instance

class grab.cookie.CookieManager(cookiejar=None)[source]¶

Each Grab instance has cookies attribute that is instance of CookieManager class.

That class contains helpful methods to create, load, save cookies from/to different places.

__init__(cookiejar=None)[source]¶
set(name, value, domain, **kwargs)[source]¶

Add new cookie or replace existing cookie with same parameters.

Parameters
  • name – name of cookie

  • value – value of cookie

  • kwargs – extra attributes of cookie

update(cookies)[source]¶
clear()[source]¶
__getitem__(key)[source]¶

Implements dict interface, allows to get cookie value by its name.

items()[source]¶
get_dict()[source]¶
load_from_file(path)[source]¶

Load cookies from the file.

Content of file should be a JSON-serialized list of dicts.

save_to_file(path)[source]¶

Dump all cookies to file.

Cookies are dumped as JSON-serialized dict of keys and values.

Grab

Navigation

  • Grab Installation
  • Testing Grab Framework
  • Grab Quickstart
  • Request Methods
  • Setting up the Grab Request
  • Grab Settings
  • Debugging
  • Work with HTTP Headers
  • Processing the Response Body
  • File Uploading
  • Redirect Handling
  • Form Processing
  • Network Errors Handling
  • HTML Document Charset
  • Cookie Support
  • Proxy Server Support
  • Searching the response body
  • Work With Network Response
  • Network Transport
  • What is Grab::Spider?
  • Task Object
  • Task Queue
  • Spider Cache
  • Spider Error Handling
  • Explanation
  • Module grab.base
  • Module grab.error
  • Module grab.cookie
  • Module grab.spider
  • Module grab.document
  • Module grab.spider.task

Related Topics

  • Documentation overview
    • Previous: Module grab.error
    • Next: Module grab.spider

Quick search

©2015 – 2022, Gregory Petukhov. | Powered by Sphinx 4.4.0 & Alabaster 0.7.12 | Page source