Skip to main content

Check remote calls via request

Project description

Build Status PyPI

A tool to check for remote calls via the requests module.

Working on a large and complicated codebase with lot’s of slow unit tests? Suspect external API calls are slowing things down?

Here’s a quick tool for just that purpose.

Usage

import unittest
import monitor_requests
from example import example_method

class ExampleTestCase(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.monitor = monitor_requests.Monitor()

    @classmethod
    def tearDownClass(cls):
        print('External calls for example:')
        cls.monitor.report()
        cls.monitor.stop()

    def test_example_method(self):
        result = example_method()
        self.assertEqual(result.status_code, 200)

if __name__ == 'main':
    unittest.main()

Of course you can also set this up inside a test runner (or a session fixture if using py.test). You can also write to a file.

Installation

pip install MonitorRequests

Project details


Release history Release notifications

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
MonitorRequests-0.0.0-py2.py3-none-any.whl (4.8 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jun 26, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page