Module grab.cookie — 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)

  Creates cookielib.Cookie instance

class `grab.cookie.` `CookieManager`(cookiejar=None)

  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)
  `set`(name, value, domain, **kwargs)

    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)
  `clear`()
  `__getitem__`(key)

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

  `items`()
  `get_dict`()
  `load_from_file`(path)

    Load cookies from the file.

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

  `save_to_file`(path)

    Dump all cookies to file.

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

Developed by GrabLab - web scraping and data mining services.

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