Skip to main content

session request

PyPI PyPI - Downloads PyPI - Python Version PyPI - License

以类的形式封装请求接口,支持requests所有参数

Github: https://github.com/mouday/session-request

pypi: https://pypi.org/project/session-request

安装

pip install session-request

使用

# -*- coding: utf-8 -*-

from session_request import Request


class ClientApi(Request):
    def after_request(self, response):
        """请求后 响应处理器"""
        return response.json()

    def get_request(self):
        options = {
            'path': '/get'
        }
        return self.get(**options)


if __name__ == '__main__':
    base_url = 'http://httpbin.org'
    api = ClientApi(base_url=base_url)
    res = api.get_request()
    print(res['url'])
    # http://httpbin.org/get

Metadata

Release files for session-request 0.0.4

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

Source distribution (sdist)

Source distribution for session-request 0.0.4
File Size Uploaded
session-request-0.0.4.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for session-request 0.0.4
File Interpreter ABI Platform
session_request-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.4 kB

Release files / session-request-0.0.4.tar.gz

Download URL session-request-0.0.4.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7d8157e2316b4863cf2a7cf1f575303577d2952da1844fe3bb1fd7668206b4da
BLAKE2b-256 checksum
How to use checksums
20312d7d01c2cb8faeac96cc173e72b7e52d3329285299685c40d4cdd9c763b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.0

Release files / session_request-0.0.4-py3-none-any.whl

Download URL session_request-0.0.4-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c629d00f5e8fc22bff514b42bdfc69be79c157a8d9a445e240832bd564b5492
BLAKE2b-256 checksum
How to use checksums
1668b8c4faa12e59c11939ca78d9c045ac936d69b1cbb288138ac4c56c50a7d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 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