a http request class
Project description
session request
以类的形式封装请求接口,支持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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
session-request-0.0.4.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file session-request-0.0.4.tar.gz
.
File metadata
- Download URL: session-request-0.0.4.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d8157e2316b4863cf2a7cf1f575303577d2952da1844fe3bb1fd7668206b4da |
|
MD5 | d6b2a4b3d12d74931ff9a2e46e714c6d |
|
BLAKE2b-256 | 20312d7d01c2cb8faeac96cc173e72b7e52d3329285299685c40d4cdd9c763b8 |
File details
Details for the file session_request-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: session_request-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c629d00f5e8fc22bff514b42bdfc69be79c157a8d9a445e240832bd564b5492 |
|
MD5 | 540b5dfc2ac6de3b654caf2530d4d797 |
|
BLAKE2b-256 | 1668b8c4faa12e59c11939ca78d9c045ac936d69b1cbb288138ac4c56c50a7d4 |