# session request
![PyPI](https://img.shields.io/pypi/v/session-request.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/session-request)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/session-request)
![PyPI - License](https://img.shields.io/pypi/l/session-request)
以类的形式封装请求接口,支持requests所有参数
Github: [https://github.com/mouday/session-request](https://github.com/mouday/session-request)
pypi: [https://pypi.org/project/session-request](https://pypi.org/project/session-request)
安装
```bash
pip install session-request
```
使用
```python
# -*- 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/mouday/session-request",
"name": "session-request",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "session,request,http,api",
"author": "Peng Shiyu",
"author_email": "pengshiyuyx@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/20/31/2d7d01c2cb8faeac96cc173e72b7e52d3329285299685c40d4cdd9c763b8/session-request-0.0.4.tar.gz",
"platform": "",
"description": "# session request\n\n![PyPI](https://img.shields.io/pypi/v/session-request.svg)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/session-request)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/session-request)\n![PyPI - License](https://img.shields.io/pypi/l/session-request)\n\n\n\u4ee5\u7c7b\u7684\u5f62\u5f0f\u5c01\u88c5\u8bf7\u6c42\u63a5\u53e3\uff0c\u652f\u6301requests\u6240\u6709\u53c2\u6570\n\nGithub: [https://github.com/mouday/session-request](https://github.com/mouday/session-request)\n\npypi: [https://pypi.org/project/session-request](https://pypi.org/project/session-request)\n\n\n\u5b89\u88c5\n```bash\npip install session-request\n```\n\n\u4f7f\u7528\n```python\n# -*- coding: utf-8 -*-\n\nfrom session_request import Request\n\n\nclass ClientApi(Request):\n def after_request(self, response):\n \"\"\"\u8bf7\u6c42\u540e \u54cd\u5e94\u5904\u7406\u5668\"\"\"\n return response.json()\n\n def get_request(self):\n options = {\n 'path': '/get'\n }\n return self.get(**options)\n\n\nif __name__ == '__main__':\n base_url = 'http://httpbin.org'\n api = ClientApi(base_url=base_url)\n res = api.get_request()\n print(res['url'])\n # http://httpbin.org/get\n\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "a http request class",
"version": "0.0.4",
"project_urls": {
"Homepage": "https://github.com/mouday/session-request"
},
"split_keywords": [
"session",
"request",
"http",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1668b8c4faa12e59c11939ca78d9c045ac936d69b1cbb288138ac4c56c50a7d4",
"md5": "540b5dfc2ac6de3b654caf2530d4d797",
"sha256": "6c629d00f5e8fc22bff514b42bdfc69be79c157a8d9a445e240832bd564b5492"
},
"downloads": -1,
"filename": "session_request-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "540b5dfc2ac6de3b654caf2530d4d797",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3285,
"upload_time": "2021-03-12T08:16:33",
"upload_time_iso_8601": "2021-03-12T08:16:33.277438Z",
"url": "https://files.pythonhosted.org/packages/16/68/b8c4faa12e59c11939ca78d9c045ac936d69b1cbb288138ac4c56c50a7d4/session_request-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "20312d7d01c2cb8faeac96cc173e72b7e52d3329285299685c40d4cdd9c763b8",
"md5": "d6b2a4b3d12d74931ff9a2e46e714c6d",
"sha256": "7d8157e2316b4863cf2a7cf1f575303577d2952da1844fe3bb1fd7668206b4da"
},
"downloads": -1,
"filename": "session-request-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "d6b2a4b3d12d74931ff9a2e46e714c6d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3110,
"upload_time": "2021-03-12T08:16:35",
"upload_time_iso_8601": "2021-03-12T08:16:35.134811Z",
"url": "https://files.pythonhosted.org/packages/20/31/2d7d01c2cb8faeac96cc173e72b7e52d3329285299685c40d4cdd9c763b8/session-request-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-03-12 08:16:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mouday",
"github_project": "session-request",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "session-request"
}