jkit


Namejkit JSON
Version 3.0.0b3 PyPI version JSON
download
home_pageNone
Summary简书非官方 SDK - 创造可能性
upload_time2025-02-13 05:32:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2025 FHU-yezi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # JKit

[![许可证](https://img.shields.io/github/license/FHU-yezi/JKit?style=flat-square&label=%E8%AE%B8%E5%8F%AF%E8%AF%81)](https://github.com/FHU-yezi/JKit/blob/v3/LICENSE)
[![简书主页](https://img.shields.io/badge/%E7%AE%80%E4%B9%A6-%E5%88%9D%E5%BF%83%E4%B8%8D%E5%8F%98__%E5%8F%B6%E5%AD%90-black?style=flat-square&color=EA6F5A)](https://www.jianshu.com/u/ea36c8d8aa30)

[![PyPI 最新版](https://img.shields.io/pypi/v/jkit?style=flat-square&label=PyPI)
](https://pypi.python.org/pypi/jkit)
[![支持的 Python 版本](https://img.shields.io/pypi/pyversions/jkit.svg?style=flat-square&label=Python%20%E7%89%88%E6%9C%AC)](https://pypi.python.org/pypi/jkit)

[![Ruff](https://img.shields.io/badge/%E9%9D%99%E6%80%81%E6%A3%80%E6%9F%A5-Ruff-purple?style=flat-square)
](https://github.com/astral-sh/ruff)
[![Pyright](https://img.shields.io/badge/%E7%B1%BB%E5%9E%8B%E6%A3%80%E6%9F%A5-Pyright-blue?style=flat-square)
](https://github.com/microsoft/pyright)
[![Black](https://img.shields.io/badge/%E4%BB%A3%E7%A0%81%E9%A3%8E%E6%A0%BC-Black-black?style=flat-square)
](https://github.com/psf/black)


<p align="center">
  <b>创造可能性。</b>
</p>

> [!WARNING]
> JKit v3 正在 Beta 测试中,可能随时进行重大变更。

# 快速上手

```bash
pip install jkit --pre
```

```python
import asyncio

from jkit.user import User


async def main() -> None:
    user = User.from_url("https://www.jianshu.com/u/622a3993108c")

    info = await user.info
    print(f"用户昵称:{info.name}")
    print(
        f"性别:{info.gender.value},会员等级:{info.membership_info.type.value}\n"
        f"会员过期时间:{info.membership_info.expire_time}"
    )


asyncio.run(main())
```

```
用户昵称:任真
性别:女,会员等级:白金会员
会员过期时间:2024-04-12 14:24:24
```

# 亮点

- [x] 完全异步操作
- [x] 基于 [msgspec](https://github.com/jcrist/msgspec) 的数据模型和自动校验

# 获取简书鉴权 Token

**目前仅支持电脑端操作。**

登录简书账号后,打开浏览器开发者工具(F12),选择「存储」(Storage)选项卡,找到域名 `https://www.jianshu.com` 下存储的 Cookies 列表。

获取键 `remember_user_token` 对应的值,然后初始化 `JianshuCredential` 对象,代码如下所示:

```python
from jkit.credential import JianshuCredential

credential = JianshuCredential(
    token="<remember_user_token>"
)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "FHU-yezi <yehaowei20060411@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/2f/6b/37e57abb072cfcdcd23e20e710550421c7dc675419cfdb457c4d7aff4708/jkit-3.0.0b3.tar.gz",
    "platform": null,
    "description": "# JKit\n\n[![\u8bb8\u53ef\u8bc1](https://img.shields.io/github/license/FHU-yezi/JKit?style=flat-square&label=%E8%AE%B8%E5%8F%AF%E8%AF%81)](https://github.com/FHU-yezi/JKit/blob/v3/LICENSE)\n[![\u7b80\u4e66\u4e3b\u9875](https://img.shields.io/badge/%E7%AE%80%E4%B9%A6-%E5%88%9D%E5%BF%83%E4%B8%8D%E5%8F%98__%E5%8F%B6%E5%AD%90-black?style=flat-square&color=EA6F5A)](https://www.jianshu.com/u/ea36c8d8aa30)\n\n[![PyPI \u6700\u65b0\u7248](https://img.shields.io/pypi/v/jkit?style=flat-square&label=PyPI)\n](https://pypi.python.org/pypi/jkit)\n[![\u652f\u6301\u7684 Python \u7248\u672c](https://img.shields.io/pypi/pyversions/jkit.svg?style=flat-square&label=Python%20%E7%89%88%E6%9C%AC)](https://pypi.python.org/pypi/jkit)\n\n[![Ruff](https://img.shields.io/badge/%E9%9D%99%E6%80%81%E6%A3%80%E6%9F%A5-Ruff-purple?style=flat-square)\n](https://github.com/astral-sh/ruff)\n[![Pyright](https://img.shields.io/badge/%E7%B1%BB%E5%9E%8B%E6%A3%80%E6%9F%A5-Pyright-blue?style=flat-square)\n](https://github.com/microsoft/pyright)\n[![Black](https://img.shields.io/badge/%E4%BB%A3%E7%A0%81%E9%A3%8E%E6%A0%BC-Black-black?style=flat-square)\n](https://github.com/psf/black)\n\n\n<p align=\"center\">\n  <b>\u521b\u9020\u53ef\u80fd\u6027\u3002</b>\n</p>\n\n> [!WARNING]\n> JKit v3 \u6b63\u5728 Beta \u6d4b\u8bd5\u4e2d\uff0c\u53ef\u80fd\u968f\u65f6\u8fdb\u884c\u91cd\u5927\u53d8\u66f4\u3002\n\n# \u5feb\u901f\u4e0a\u624b\n\n```bash\npip install jkit --pre\n```\n\n```python\nimport asyncio\n\nfrom jkit.user import User\n\n\nasync def main() -> None:\n    user = User.from_url(\"https://www.jianshu.com/u/622a3993108c\")\n\n    info = await user.info\n    print(f\"\u7528\u6237\u6635\u79f0\uff1a{info.name}\")\n    print(\n        f\"\u6027\u522b\uff1a{info.gender.value}\uff0c\u4f1a\u5458\u7b49\u7ea7\uff1a{info.membership_info.type.value}\\n\"\n        f\"\u4f1a\u5458\u8fc7\u671f\u65f6\u95f4\uff1a{info.membership_info.expire_time}\"\n    )\n\n\nasyncio.run(main())\n```\n\n```\n\u7528\u6237\u6635\u79f0\uff1a\u4efb\u771f\n\u6027\u522b\uff1a\u5973\uff0c\u4f1a\u5458\u7b49\u7ea7\uff1a\u767d\u91d1\u4f1a\u5458\n\u4f1a\u5458\u8fc7\u671f\u65f6\u95f4\uff1a2024-04-12 14:24:24\n```\n\n# \u4eae\u70b9\n\n- [x] \u5b8c\u5168\u5f02\u6b65\u64cd\u4f5c\n- [x] \u57fa\u4e8e [msgspec](https://github.com/jcrist/msgspec) \u7684\u6570\u636e\u6a21\u578b\u548c\u81ea\u52a8\u6821\u9a8c\n\n# \u83b7\u53d6\u7b80\u4e66\u9274\u6743 Token\n\n**\u76ee\u524d\u4ec5\u652f\u6301\u7535\u8111\u7aef\u64cd\u4f5c\u3002**\n\n\u767b\u5f55\u7b80\u4e66\u8d26\u53f7\u540e\uff0c\u6253\u5f00\u6d4f\u89c8\u5668\u5f00\u53d1\u8005\u5de5\u5177\uff08F12\uff09\uff0c\u9009\u62e9\u300c\u5b58\u50a8\u300d\uff08Storage\uff09\u9009\u9879\u5361\uff0c\u627e\u5230\u57df\u540d `https://www.jianshu.com` \u4e0b\u5b58\u50a8\u7684 Cookies \u5217\u8868\u3002\n\n\u83b7\u53d6\u952e `remember_user_token` \u5bf9\u5e94\u7684\u503c\uff0c\u7136\u540e\u521d\u59cb\u5316 `JianshuCredential` \u5bf9\u8c61\uff0c\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a\n\n```python\nfrom jkit.credential import JianshuCredential\n\ncredential = JianshuCredential(\n    token=\"<remember_user_token>\"\n)\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 FHU-yezi  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "\u7b80\u4e66\u975e\u5b98\u65b9 SDK - \u521b\u9020\u53ef\u80fd\u6027",
    "version": "3.0.0b3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "eea005eaf3240321bf80d2d9cfc9b877bc70b82ba3282a3a95653229fd822169",
                "md5": "1813b23092cad767b8e3448326384bd7",
                "sha256": "3e86a010cb6176a521da983e3314202d86fef0db0f7a55ea7636a18685eca830"
            },
            "downloads": -1,
            "filename": "jkit-3.0.0b3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1813b23092cad767b8e3448326384bd7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 34563,
            "upload_time": "2025-02-13T05:32:33",
            "upload_time_iso_8601": "2025-02-13T05:32:33.704481Z",
            "url": "https://files.pythonhosted.org/packages/ee/a0/05eaf3240321bf80d2d9cfc9b877bc70b82ba3282a3a95653229fd822169/jkit-3.0.0b3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2f6b37e57abb072cfcdcd23e20e710550421c7dc675419cfdb457c4d7aff4708",
                "md5": "e7d8e94e30b3e9fb1986f12d868f6890",
                "sha256": "8bcdde4ddc11de13058997004a0844f499f3d8270506543c6e2e1c59475bb20d"
            },
            "downloads": -1,
            "filename": "jkit-3.0.0b3.tar.gz",
            "has_sig": false,
            "md5_digest": "e7d8e94e30b3e9fb1986f12d868f6890",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 20118,
            "upload_time": "2025-02-13T05:32:35",
            "upload_time_iso_8601": "2025-02-13T05:32:35.387722Z",
            "url": "https://files.pythonhosted.org/packages/2f/6b/37e57abb072cfcdcd23e20e710550421c7dc675419cfdb457c4d7aff4708/jkit-3.0.0b3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-13 05:32:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "jkit"
}
        
Elapsed time: 0.38211s