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 SessionRequest
class ClientApi(SessionRequest):
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.3.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for session_request-0.0.3-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1af0357d914cb70125627dc1274a6f6d7a4d07a835da21c719164a4b6cefdb2c |
|
MD5 | 1813faed5e65f47e13bf980c3b5112ea |
|
BLAKE2b-256 | bf4c526f3f28e84028bbabb3de112f656a7f4a3923b144ab948c05e8eed8e733 |