requests_logger

Wrapper around Requests to add logging


Keywords
requests, logging, request
License
Other
Install
pip install requests_logger==0.2.0

Documentation

PyPI Travis

Requests Logging

This package is a wrapper around Requests to log http requests in a human readable format.

Version

v0.2.0

Installation

pip install requests_logger

Quickstart

import logging
from requests_logger import LoggingRequests

# Setup logger
logger = logging.getLogger('requests_logger') #  Gets base logger for LoggingRequests
handler = logging.FileHandler('logs.log', mode='w')
formater = logging.Formatter('%(asctime)s: %(levelname)s: %(name)s: %(message)s')
handler.setFormatter(formater)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)

response = LoggingRequests.request('GET', 'http://google.com')

Development

Want to contribute? Great! Fork and submit a pull request!

Todos

- Format json and xml request/response bodies
- Rename package (maybe)
- Rename Class (maybe)
- Write more tests