<commit_before>Raven
=====

Raven Request is a custom Requests class to log onto Raven, the University of Cambridge's central
web authentication service.


Installation
------------
	
.. code-block:: bash

	$ pip install ravenrequest


Documentation
-------------

Detailed documentation available at `erinhengel.com <http://www.erinhengel.com/software/raven-request/>`_. 


Quickstart
----------

The Raven class logs into Raven and establishes a connection with the host. The ``session`` attribute returns a `Request Session object <http://requests.readthedocs.org/en/latest/user/advanced/#session-objects>`_ with all the methods of the main `Requests API <http://requests.readthedocs.org/en/latest/>`_.


.. code-block:: python

    >>> from raven_request import Raven
	
    # Establish Raven connection object for the website www.example.com.
    >>> deets = {'userid': 'ab123', 'pwd': '<PASSWORD>'}
    >>> conn = Raven(url='http://qje.oxfordjournals.org', login=deets)
	
    # The final destination url looks something like this.
    >>> conn.url
    http://libsta28.lib.cam.ac.uk:2924
	
    # Use session attribute to access Requests methods.
	>>> url = conn.url + '/content/130/4/1623.full'
    >>> request = conn.session.get(url)
    >>> request.status_code
    200
	
    # Do stuff with your request object.
    >>> from bs4 import BeautifulSoup
    >>> soup = BeautifulSoup(request.text, 'html.parser')
    >>> soup.title
	<title>Behavioral Hazard in Health Insurance </title>


JSTOR, EBSCOhost and Wiley are Raven subclasses specifically for logging onto www.jstor.org,
www.ebscohost.com and onlinelibrary.wiley.com respectively. They include the ``html``, ``pdf``
and ``ref`` methods to download the webpage, pdf and bibliographic information, respectively,
of a particular document in their databases.

.. code-block:: python
    
    >>> from raven_request import JSTOR
	
    # Establish Raven conncection object to the document 10.1068/682574 on jstor.org.
    >>> doi = '10.1086/682574'
    >>> conn = JSTOR(login=deets)
	
    # Download the html of the document webpage.
    >>> html = conn.html(id=doi)
	
    # Download the document pdf.
    >>> pdf = conn.pdf(id=doi)
    
	# Download the biliographic information.
	>>> biblio = conn.ref(id=doi)
	>>> biblio['authors']
	[{'name': '<NAME>'}, {'name': '<NAME>'}]
<commit_msg>	modified:   README.rst<commit_after>Raven
=====

Raven Request is a custom Requests class to log onto Raven, the University of Cambridge's central
web authentication service.


Installation
------------
	
.. code-block:: bash

	$ pip install raven_request


Documentation
-------------

Detailed documentation available at `erinhengel.com <http://www.erinhengel.com/software/raven-request/>`_. 


Quickstart
----------

The Raven class logs into Raven and establishes a connection with the host. The ``session`` attribute returns a `Request Session object <http://requests.readthedocs.org/en/latest/user/advanced/#session-objects>`_ with all the methods of the main `Requests API <http://requests.readthedocs.org/en/latest/>`_.


.. code-block:: python

    >>> from raven_request import Raven
	
    # Establish Raven connection object for the website www.example.com.
    >>> deets = {'userid': 'ab123', 'pwd': '<PASSWORD>'}
    >>> conn = Raven(url='http://qje.oxfordjournals.org', login=deets)
	
    # The final destination url looks something like this.
    >>> conn.url
    http://libsta28.lib.cam.ac.uk:2924
	
    # Use session attribute to access Requests methods.
	>>> url = conn.url + '/content/130/4/1623.full'
    >>> request = conn.session.get(url)
    >>> request.status_code
    200
	
    # Do stuff with your request object.
    >>> from bs4 import BeautifulSoup
    >>> soup = BeautifulSoup(request.text, 'html.parser')
    >>> soup.title
    <title>Behavioral Hazard in Health Insurance </title>


JSTOR, EBSCOhost and Wiley are Raven subclasses specifically for logging onto www.jstor.org,
www.ebscohost.com and onlinelibrary.wiley.com respectively. They include the ``html``, ``pdf``
and ``ref`` methods to download the webpage, pdf and bibliographic information, respectively,
of a particular document in their databases.

.. code-block:: python
    
    >>> from raven_request import JSTOR
	
    # Establish Raven conncection object to the document 10.1068/682574 on jstor.org.
    >>> doi = '10.1086/682574'
    >>> conn = JSTOR(login=deets)
	
    # Download the html of the document webpage.
    >>> html = conn.html(id=doi)
	
    # Download the document pdf.
    >>> pdf = conn.pdf(id=doi)
    
    # Download the biliographic information.
    >>> biblio = conn.ref(id=doi)
    >>> biblio['authors']
    [{'name': '<NAME>'}, {'name': '<NAME>'}]

{'fraction_non_alphanumeric': 0.13873568095036062, 'fraction_numerical': 0.019092066185829443, 'mean_word_length': 3.3779015784586814, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 121, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4454531', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1380, 'n_words': 438}