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 hashes)
Built Distribution
Close
Hashes for session_request-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c629d00f5e8fc22bff514b42bdfc69be79c157a8d9a445e240832bd564b5492 |
|
MD5 | 540b5dfc2ac6de3b654caf2530d4d797 |
|
BLAKE2b-256 | 1668b8c4faa12e59c11939ca78d9c045ac936d69b1cbb288138ac4c56c50a7d4 |