Navigation

  • index
  • modules |
  • next |
  • previous |
  • Grab 1.2.0 documentation »
  • Module grab.cookie

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.

Table of Contents

  • Module grab.cookie
    • create_cookie()
    • CookieManager
      • CookieManager.__init__()
      • CookieManager.set()
      • CookieManager.update()
      • CookieManager.clear()
      • CookieManager.__getitem__()
      • CookieManager.items()
      • CookieManager.get_dict()
      • CookieManager.load_from_file()
      • CookieManager.save_to_file()

Previous topic

Module grab.error

Next topic

Module grab.spider

This Page

  • Show Source

Quick search

Navigation

  • index
  • modules |
  • next |
  • previous |
  • Grab 1.2.0 documentation »
  • Module grab.cookie
© Copyright 2013-2025, Gregory Petukhov. Created using Sphinx 8.2.3.

Developed by me

Jut a friend of mine who does web-scrpaing too: www.imscraping.ninja.