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.2.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for session_request-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e53cd935ecfb54f917f85d325078dc08ff9e0a8e99900023bd54582e618401d6 |
|
MD5 | cc5ae58d4901093a007c10f9acbaf468 |
|
BLAKE2b-256 | a75d9bbf0fb18e0af401c336336fb6ba28fe67ac9be60868f2fdc177141c7b1e |