Skip to main content

requests-mv-integrations

Extension of Python HTTP requests with verbose logging using logging-mv-integrations.

Badges

docs

Documentation Status License Status

info

Hit Count Contributors

tests

Travis-CI Build Status Code Coverage Status

package

PyPI Package latest release Supported versions

other

Requirements Status

Install

pip install requests_mv_integrations

Architecture

requests-mv-integrations is an extension of the Python package requests and it is used for TUNE Multiverse Integrations for handling all HTTP requests including APIs in REST and SOAP, screen scrapping, and handling response downloads in JSON, XML, and CSV.

UML requests-mv-integrations

Usage

URL_TUNE_MAT_API_COUNTRIES = \
    'https://api.mobileapptracking.com/v2/countries/find.json'

from requests_mv_integrations import (
    RequestMvIntegrationDownload,
)
request_download = RequestMvIntegrationDownload(logger_level=logging.DEBUG)

result = \
    request_download.request(
        request_method='GET',
        request_url=URL_TUNE_MAT_API_COUNTRIES,
        request_params=None,
        request_retry=None,
        request_headers=HEADER_CONTENT_TYPE_APP_JSON,
        request_label="TMC Countries"
    )

json_tune_mat_countries = result.json()

pprint(json_tune_mat_countries)

Example

$ python3 examples/example_request.py

{
    "asctime": "2017-10-13 12:02:53 -0700",
    "levelname": "INFO",
    "name": "__main__",
    "version": "00.05.04",
    "message": "Start"
}
{
    "asctime": "2017-10-13 12:02:53 -0700",
    "levelname": "DEBUG",
    "name": "requests_mv_integrations",
    "version": "00.05.04",
    "message": "TMC Countries: Start"
}
...
{
    "asctime": "2017-10-13 12:02:53 -0700",
    "levelname": "DEBUG",
    "name": "requests_mv_integrations",
    "version": "00.05.04",
    "message": "TMC Countries: Details",
    "request_data": "",
    "request_headers": {
        "Content-Type": "application/json",
        "User-Agent": "(requests-mv-integrations/00.05.04, Python/3.6.2)"},
        "request_label": "TMC Countries",
        "request_method": "GET",
        "request_params": {},
        "request_url": "https://api.mobileapptracking.com/v2/countries/find.json",
        "timeout": 60
}
{
    "asctime": "2017-10-13 12:02:53 -0700",
    "levelname": "DEBUG",
    "name": "requests_mv_integrations",
    "version": "00.05.04",
    "message": "TMC Countries: Curl",
    "request_curl": "curl --verbose
        -X GET
        -H 'Content-Type: application/json'
        -H 'User-Agent: (requests-mv-integrations/00.05.04, Python/3.6.2)'
        --connect-timeout 60
        -L 'https://api.mobileapptracking.com/v2/countries/find.json'",
    "request_label": "TMC Countries",
    "request_method": "GET"
}
...
{
    'data': [
        {'id': 0, 'name': 'International (Generic)'},
        {'id': 4, 'name': 'Afghanistan'},
        {'id': 8, 'name': 'Albania'},
        {'id': 10, 'name': 'Antarctica'},
        {'id': 12, 'name': 'Algeria'},
        {'id': 16, 'name': 'American Samoa'},
        {'id': 20, 'name': 'Andorra'},
        {'id': 24, 'name': 'Angola'},
        {'id': 28, 'name': 'Antigua And Barbuda'},
        {'id': 31, 'name': 'Azerbaijan'},
    ],
    'response_size': '845',
    'status_code': 200,
}

Classes

  • class RequestMvIntegration – Base class using requests with retry functionality and verbose logging.

  • class RequestMvIntegrationDownload – Download file handling.

  • class RequestMvIntegrationUpload – Upload file handling.

Requirements

requests-mv-integrations module is built upon Python 3 and has dependencies upon several Python modules available within Python Package Index PyPI.

make install

or

python3 -m pip uninstall --yes --no-input -r requirements.txt
python3 -m pip install --upgrade -r requirements.txt

Packages

Release History

0.7.7 (2018-02-16)

  • migrate to github/TuneLab

0.7.6 (2018-02-07)

  • Updated requirements.txt

0.7.5 (2018-01-28)

  • Upgraded to use pyhttpstatus-utils 0.2.2.

0.7.4 (2018-01-25)

  • migrate to github/tuneinc

0.7.2 (2017-12-10)

  • readthedocs.org

0.6.0 (2017-11-24)

  • README

0.5.7 (2017-10-31)

  • README

0.5.6 (2017-10-26)

  • Using formatted string literals

0.5.5 (2017-09-12)

  • logger_output: STDOUT, STDOUT_COLOR, FILE

  • logger_filter: NOTE

0.5.4 (2017-09-12)

  • Support logging-mv-integrations refactor

0.5.3 (2017-08-13)

  • Fix Retry exception functions

0.5.2 (2017-06-15)

  • Requirements.txt - update python packages to latest

0.5.1 (2017-06-15)

  • Collect metrics for MvRequest calls

0.5.0 (2017-04-07)

  • support client side certificate

0.4.9 (2017-04-01)q

  • Requirements.

0.4.8 (2017-03-30)

  • Retry exception function.

0.4.6 (2017-03-28)

  • logger-mv-integrations version 0.1.2

  • validate_response() and validate_json_response()

0.4.5 (2017-03-14)

  • smart-cast

0.4.4 (2017-03-12)

  • use sessions cookies as request_auth

0.4.3 (2017-03-02)

  • replace ‘json’ with ‘ujson’

0.4.2 (2017-02-27)

  • psutil

  • Back to Python 3.5

0.4.1 (2017-02-09)

  • cUrl request params

0.4.0 (2017-02-09)

  • Requirements.

  • RetryError

0.3.9 (2017-02-06)

  • TuneRequest is not a Singleton.

0.3.8 (2017-02-03)

  • Upgrade to Python 3.6

0.3.5 (2017-01-27)

  • Reduce logging

  • Disc usage

  • Iron.io Partition

0.3.3 (2017-01-26)

  • Cleanup using pyflakes, pep8, pylint, and yapf

  • Requirements

0.3.2 (2017-01-24)

  • Curl fix

0.3.1 (2017-01-18)

  • Log reduction

0.2.9 (2017-01-17)

  • psutil: disc and mem usage

  • Cleanup

0.2.8 (2017-01-16)

  • Cleanup yapf

0.2.7 (2017-01-16)

  • Build Curl

  • Cleanup

0.2.6 (2017-01-14)

  • Requirements

0.2.5 (2017-01-04)

  • Cleanup

0.2.4 (2017-01-04)

  • request timeout

0.2.3 (2016-12-31)

  • test_curl

  • parse_curl

0.2.2 (2016-12-30)

  • Makefile

0.2.1 (2016-12-29)

  • README.rst

  • HISTORY.rst

0.2.0 (2016-12-19)

  • Expose response url

0.1.8 (2016-12-09)

  • Base Exception cleanup

0.1.6 (2016-12-08)

  • Error Origin

0.1.5 (2016-12-07)

  • Log Exit Code

0.1.1 (2016-12-03)

  • Include request_auth in curl

0.1.0 (2016-11-25)

  • Initial Release

0..1 (2016-11-18)

  • Conception

  • Code pulled from TuneLab/tune-mv-integration-python

Metadata

Release files for requests-mv-integrations 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for requests-mv-integrations 0.8.0
File Size Uploaded
requests-mv-integrations-0.8.0.tar.gz 71.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for requests-mv-integrations 0.8.0
File Interpreter ABI Platform
requests_mv_integrations-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 115.3 kB

Release files / requests-mv-integrations-0.8.0.tar.gz

Download URL requests-mv-integrations-0.8.0.tar.gz
Size 71.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f23c61ca448373e2050e6493f5ca8e67c4383bc15819c2a0d621b079a0509c4b
BLAKE2b-256 checksum
How to use checksums
1241808a51303b57581c1733d2221634711f97662f075f90b0a7eca6610c90e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / requests_mv_integrations-0.8.0-py3-none-any.whl

Download URL requests_mv_integrations-0.8.0-py3-none-any.whl
Size 43.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6137375a7e807a1536b91d959966a23ad44f5731c5230b14a93c03d414f771e
BLAKE2b-256 checksum
How to use checksums
7cabfc2eb90969036948873cd845d0065bea8676242373a75abc6d81d20f3aa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

3 release files

0.7.2

3 release files

0.7.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page