Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Requests wrapper to log onto Raven (University of Cambridge).

Project Description

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

Installation

$ pip install requests_raven

Documentation

Detailed documentation available at erinhengel.com/software/requests_raven.

Quickstart

The Raven class logs onto Raven and establishes a connection with the host. The session attribute returns a Request Session object with all the methods of the main Requests API.

>>> from requests_raven import Raven

# Establish Raven connection object for the website qje.oxfordjournals.org.
>>> deets = {'userid': 'ab123', 'pwd': 'XXXX'}
>>> 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:2314'

# Use session attribute to access Requests methods.
>>> url = '{}/content/130/4/1623.full'.format(conn.url)
>>> 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 jstor.org, ebscohost.com and onlinelibrary.wiley.com, respectively. They include the html, pdf and ref methods to download the webpage HTML, PDF and bibliographic information of a particular document.

>>> from requests_raven import JSTOR

# Establish Raven connection object for the website jstor.org.
>>> conn = JSTOR(login=deets)

# Download the HTML of the JSTOR webpage for the article with document id 10.1068/682574.
>>> doc_id = '10.1086/682574'
>>> html = conn.html(id=doc_id)

# Download the document PDF.
>>> pdf = conn.pdf(id=doc_id, file='article.pdf')

# Download the bibliographic information.
>>> biblio = conn.ref(id=doc_id)
>>> biblio['authors']
[{'name': 'Per Krusell'}, {'name': 'Anthony A. Smith'}]
Release History

Release History

This version
History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
requests-raven-0.0.1.tar.gz (8.5 kB) Copy SHA256 Checksum SHA256 Source Dec 24, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting