Navigation

  • index
  • modules |
  • next |
  • previous |
  • Grab 0.6 documentation »

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.

Previous topic

Module grab.error

Next topic

Module grab.spider

This Page

  • Show Source

Quick search

Navigation

  • index
  • modules |
  • next |
  • previous |
  • Grab 0.6 documentation »
© Copyright 2015, Gregory Petukhov. Created using Sphinx 1.6.3.

Developed by GrabLab - web scraping and data mining services.

He also does web scraping: www.imscraping.ninja.