Metadata-Version: 2.0
Name: pycookiecheat
Version: 0.3.3
Summary: Borrow cookies from your browser's authenticated session foruse in Python scripts.
Home-page: https://github.com/n8henrie/pycookiecheat
Author: Nathan Henrie
Author-email: nate@n8henrie.com
License: MIT
Keywords: pycookiecheat chrome cookies
Platform: UNKNOWN
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Requires-Dist: cryptography (==1.6)
Requires-Dist: keyring (==8.7)
Provides-Extra: dev
Requires-Dist: flake8 (==3.2.1); extra == 'dev'
Requires-Dist: pypandoc (==1.3.3); extra == 'dev'
Requires-Dist: pytest (==3.0.4); extra == 'dev'
Requires-Dist: tox (==2.5.0); extra == 'dev'
Requires-Dist: twine (==1.8.1); extra == 'dev'
Requires-Dist: wheel (==0.29.0); extra == 'dev'

pycookiecheat
=============

|Build Status|

Borrow cookies from your browser's authenticated session for use in
Python scripts.

-  Free software: MIT
-  Documentation: http://n8h.me/HufI1w

Installation
------------

**NB:** Use ``pip`` and ``python`` instead of ``pip3`` and ``python3``
if you're still on Python 2.

Quickstart
~~~~~~~~~~

-  ``pip3 install pycookiecheat``

Development Setup
~~~~~~~~~~~~~~~~~

1. ``git clone https://github.com/n8henrie/pycookiecheat.git``
2. ``cd pycookiecheat``
3. ``python3 -m venv venv``
4. ``venv/bin/pip install -e .[dev]``

Usage
-----

.. code:: python

    from pycookiecheat import chrome_cookies
    import requests

    url = 'http://example.com/fake.html'

    # Uses Chrome's default cookies filepath by default
    cookies = chrome_cookies(url)
    r = requests.get(url, cookies=cookies)

Use the ``cookie_file`` keyword-argument to specify a different filepath
for the cookies-file:
``chrome_cookies(url, cookie_file='/abspath/to/cookies')``

Features
--------

-  Returns decrypted cookies from Google Chrome on OSX or Linux.

FAQ / Troubleshooting
---------------------

How about Windows?
~~~~~~~~~~~~~~~~~~

I don't use Windows or have a PC, so I won't be adding support myself.
Feel free to make a PR :)

I get an installation error with the ``cryptography`` module on OS X
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you're getting `this
error <https://github.com/n8henrie/pycookiecheat/pull/11#issuecomment-221918807>`__
and using Homebrew, then you need to follow the instructions for
`Building cryptography on OS
X <https://cryptography.io/en/latest/installation/?highlight=cflags#building-cryptography-on-os-x>`__
and
``export LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include"``
and try again.

.. |Build Status| image:: https://travis-ci.org/n8henrie/pycookiecheat.svg?branch=master
   :target: https://travis-ci.org/n8henrie/pycookiecheat


History
=======

0.3.0
-----

-  Use ```cryptography`` <https://cryptography.io/en/latest/>`__ instead
   of ``pycrypto`` (thanks to `Taik <https://github.com/Taik>`__!)
-  Seems to be `significantly
   faster <https://github.com/n8henrie/pycookiecheat/pull/11#issuecomment-221950400>`__
-  Works with PyPy >= 2.6.0 (no support for PyPy3 yet)

0.2.0
-----

-  Fix domain and subdomain matching
-  Make SQL query more secure by avoiding string formatting
-  Many thanks to `Brandon Rhodes <https://github.com/brandon-rhodes>`__
   for 24c4234 !

0.1.10
------

-  Read version to separate file so it can be imported in setup.py
-  Bugfix for python2 on linux

0.1.9
-----

-  Bugfix for python2 on linux

0.1.8
-----

-  Python2 support (thanks `dani14-96 <https://github.com/dani14-96>`__)

0.1.7
-----

-  Configurable cookies file (thanks
   `ankostis <https://github.com/ankostis>`__)

0.1.6
-----

-  OSError instead of Exception for wrong OS.
-  Moved testing requirements to tox and travis-ci files.

0.1.5
-----

-  Updated to work better with PyPI's lack of markdown support
-  Working on tox and travis-ci integration
-  Added a few basic tests that should pass if one has Chrome installed
   and has visited my site (n8henrie.com)
-  Added sys.exit(0) if cookie\_file not found so tests pass on
   travis-ci.

0.1.0 (2015-02-25)
------------------

-  First release on PyPI.

Prior changelog from Gist
-------------------------

-  20150221 v2.0.1: Now should find cookies for base domain and all
   subs.
-  20140518 v2.0: Now works with Chrome's new encrypted cookies.


