sgtpyutils


Namesgtpyutils JSON
Version 1.19.21 PyPI version JSON
download
home_pagehttps://github.com/serfend/sgtpyutils
Summarysgtpyutils is a public library for use.
upload_time2024-04-25 16:25:26
maintainerNone
docs_urlNone
authorserfend
requires_python<4,>=3.9
licenseMIT Licence
keywords lib utils
VCS
bugtrack_url
requirements scidatetime pycryptodome colorlog openpyxl argparse httpx redis fake-useragent six pathlib2 typing_extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <a href="https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2Fserfend%2Fsgtpyutils%2F"><img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fserfend%2Fsgtpyutils%2F&labelColor=%23697689&countColor=%23ff8a65&style=plastic&labelStyle=none" /></a> 
    <a href="https://pypi.python.org/pypi/sgtpyutils/"><img alt="pypi version" src="https://img.shields.io/pypi/v/sgtpyutils.svg" /></a> 
    <a href="https://pypistats.org/packages/sgtpyutils"><img alt="pypi download" src="https://img.shields.io/pypi/dm/sgtpyutils.svg" /></a>
    <a href="https://github.com/serfend/sgtpyutils/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/serfend/sgtpyutils.svg?style=flat-square" /></a>
    <a href="https://github.com/serfend/sgtpyutils/releases"><img alt="GitHub All Releases" src="https://img.shields.io/github/downloads/serfend/sgtpyutils/total.svg?style=flat-square&color=%2364ff82" /></a>
    <a href="https://github.com/serfend/sgtpyutils/commits"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/serfend/sgtpyutils.svg?style=flat-square" /></a>
    <a href="https://github.com/serfend/sgtpyutils/actions/workflows/pytest.yml"><img alt="GitHub Workflow Status" src="https://github.com/serfend/sgtpyutils/actions/workflows/pytest.yml/badge.svg" /></a>
</p>




![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white)![Kali](https://img.shields.io/badge/Kali-268BEE?style=for-the-badge&logo=kalilinux&logoColor=white)![FreeBSD](https://img.shields.io/badge/-FreeBSD-%23870000?style=for-the-badge&logo=freebsd&logoColor=white)![Deepin](https://img.shields.io/badge/Deepin-007CFF?style=for-the-badge&logo=deepin&logoColor=white)![Debian](https://img.shields.io/badge/Debian-D70A53?style=for-the-badge&logo=debian&logoColor=white)![Cent OS](https://img.shields.io/badge/cent%20os-002260?style=for-the-badge&logo=centos&logoColor=F0F0F0)

# What?

sgtpyutils is python module for common utils.



## Install

```shell
pip install sgtpyutils
```



## Usage

### 日志处理
```python
from sgtpyutils.logger import logger
logger.debug('调试')
logger.info('信息')
logger.warning('警告')
```

### 时间处理
```python
from sgtpyutils.datetime import DateTime
# 当前时间
print(DateTime()) # 2023-09-19 14:50:43.570560+08:00
# 指定日期
print(DateTime('2023-09-19')) # 2023-09-19 00:00:00+08:00
# 指定时间
print(DateTime('2023-09-19 14:50:43')) # 2023-09-19 14:50:43+08:00
# 指定时间戳
print(DateTime(1695106243000)) # 2023-09-19 14:50:43+08:00
# 指定时间及时区
print(DateTime('2023-09-19T14:50:43+07:00')) # 2023-09-19 14:50:43+07:00

# 计算时间差
print((DateTime('2023-09-20') - '2023-09-19').total_seconds()) # 86400.0
print((DateTime('2023-09-20') - 60 * 1000)) # 2023-09-19 23:59:00+08:00

# 获取相对时间
print(DateTime('2023-09-20').toRelativeTime('2023-09-20 14:23')) # 14小时前
print(DateTime('2023-09-20 10:00:00').toRelativeTime('2023-09-20 10:01:00')) # 1分钟后
print(DateTime('2023-01-20 10:00:00').toRelativeTime()) # xxx年前
```





## Status

![Alt](https://repobeats.axiom.co/api/embed/af8eefa7ce843f622f7dafbfe1879a36f872474d.svg "Repobeats analytics image")

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/serfend/sgtpyutils",
    "name": "sgtpyutils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": "lib, utils",
    "author": "serfend",
    "author_email": "serfend@foxmail.com",
    "download_url": "https://files.pythonhosted.org/packages/77/ed/cb2bcddf694c9a597a0e85651d994d0acf55b8c385c13a4a343cb7e102c9/sgtpyutils-1.19.21.tar.gz",
    "platform": "any",
    "description": "<p align=\"center\">\n    <a href=\"https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2Fserfend%2Fsgtpyutils%2F\"><img src=\"https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fserfend%2Fsgtpyutils%2F&labelColor=%23697689&countColor=%23ff8a65&style=plastic&labelStyle=none\" /></a> \n    <a href=\"https://pypi.python.org/pypi/sgtpyutils/\"><img alt=\"pypi version\" src=\"https://img.shields.io/pypi/v/sgtpyutils.svg\" /></a> \n    <a href=\"https://pypistats.org/packages/sgtpyutils\"><img alt=\"pypi download\" src=\"https://img.shields.io/pypi/dm/sgtpyutils.svg\" /></a>\n    <a href=\"https://github.com/serfend/sgtpyutils/releases\"><img alt=\"GitHub release\" src=\"https://img.shields.io/github/release/serfend/sgtpyutils.svg?style=flat-square\" /></a>\n    <a href=\"https://github.com/serfend/sgtpyutils/releases\"><img alt=\"GitHub All Releases\" src=\"https://img.shields.io/github/downloads/serfend/sgtpyutils/total.svg?style=flat-square&color=%2364ff82\" /></a>\n    <a href=\"https://github.com/serfend/sgtpyutils/commits\"><img alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/serfend/sgtpyutils.svg?style=flat-square\" /></a>\n    <a href=\"https://github.com/serfend/sgtpyutils/actions/workflows/pytest.yml\"><img alt=\"GitHub Workflow Status\" src=\"https://github.com/serfend/sgtpyutils/actions/workflows/pytest.yml/badge.svg\" /></a>\n</p>\n\n\n\n\n![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white)![Kali](https://img.shields.io/badge/Kali-268BEE?style=for-the-badge&logo=kalilinux&logoColor=white)![FreeBSD](https://img.shields.io/badge/-FreeBSD-%23870000?style=for-the-badge&logo=freebsd&logoColor=white)![Deepin](https://img.shields.io/badge/Deepin-007CFF?style=for-the-badge&logo=deepin&logoColor=white)![Debian](https://img.shields.io/badge/Debian-D70A53?style=for-the-badge&logo=debian&logoColor=white)![Cent OS](https://img.shields.io/badge/cent%20os-002260?style=for-the-badge&logo=centos&logoColor=F0F0F0)\n\n# What?\n\nsgtpyutils is python module for common utils.\n\n\n\n## Install\n\n```shell\npip install sgtpyutils\n```\n\n\n\n## Usage\n\n### \u65e5\u5fd7\u5904\u7406\n```python\nfrom sgtpyutils.logger import logger\nlogger.debug('\u8c03\u8bd5')\nlogger.info('\u4fe1\u606f')\nlogger.warning('\u8b66\u544a')\n```\n\n### \u65f6\u95f4\u5904\u7406\n```python\nfrom sgtpyutils.datetime import DateTime\n# \u5f53\u524d\u65f6\u95f4\nprint(DateTime()) # 2023-09-19 14:50:43.570560+08:00\n# \u6307\u5b9a\u65e5\u671f\nprint(DateTime('2023-09-19')) # 2023-09-19 00:00:00+08:00\n# \u6307\u5b9a\u65f6\u95f4\nprint(DateTime('2023-09-19 14:50:43')) # 2023-09-19 14:50:43+08:00\n# \u6307\u5b9a\u65f6\u95f4\u6233\nprint(DateTime(1695106243000)) # 2023-09-19 14:50:43+08:00\n# \u6307\u5b9a\u65f6\u95f4\u53ca\u65f6\u533a\nprint(DateTime('2023-09-19T14:50:43+07:00')) # 2023-09-19 14:50:43+07:00\n\n# \u8ba1\u7b97\u65f6\u95f4\u5dee\nprint((DateTime('2023-09-20') - '2023-09-19').total_seconds()) # 86400.0\nprint((DateTime('2023-09-20') - 60 * 1000)) # 2023-09-19 23:59:00+08:00\n\n# \u83b7\u53d6\u76f8\u5bf9\u65f6\u95f4\nprint(DateTime('2023-09-20').toRelativeTime('2023-09-20 14:23')) # 14\u5c0f\u65f6\u524d\nprint(DateTime('2023-09-20 10:00:00').toRelativeTime('2023-09-20 10:01:00')) # 1\u5206\u949f\u540e\nprint(DateTime('2023-01-20 10:00:00').toRelativeTime()) # xxx\u5e74\u524d\n```\n\n\n\n\n\n## Status\n\n![Alt](https://repobeats.axiom.co/api/embed/af8eefa7ce843f622f7dafbfe1879a36f872474d.svg \"Repobeats analytics image\")\n",
    "bugtrack_url": null,
    "license": "MIT Licence",
    "summary": "sgtpyutils is a public library for use.",
    "version": "1.19.21",
    "project_urls": {
        "Homepage": "https://github.com/serfend/sgtpyutils"
    },
    "split_keywords": [
        "lib",
        " utils"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5125de0d81b5e2ab8bc37d5498bf917eba14827d7dba39f85108b35af153aa89",
                "md5": "d6fc6094b21befdc93087f694a2f43b4",
                "sha256": "57dea91e3610c9cf168927ed12f1c3a131ee4cea6b01f1c142251002df2cb095"
            },
            "downloads": -1,
            "filename": "sgtpyutils-1.19.21-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6fc6094b21befdc93087f694a2f43b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 50665,
            "upload_time": "2024-04-25T16:25:24",
            "upload_time_iso_8601": "2024-04-25T16:25:24.515771Z",
            "url": "https://files.pythonhosted.org/packages/51/25/de0d81b5e2ab8bc37d5498bf917eba14827d7dba39f85108b35af153aa89/sgtpyutils-1.19.21-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77edcb2bcddf694c9a597a0e85651d994d0acf55b8c385c13a4a343cb7e102c9",
                "md5": "b63c0861a7aad78ee6f033c23649fdec",
                "sha256": "627aee4c1f638696e120995af72e8c8fc6831fc9b8896f425084e33708d1e8e7"
            },
            "downloads": -1,
            "filename": "sgtpyutils-1.19.21.tar.gz",
            "has_sig": false,
            "md5_digest": "b63c0861a7aad78ee6f033c23649fdec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 44115,
            "upload_time": "2024-04-25T16:25:26",
            "upload_time_iso_8601": "2024-04-25T16:25:26.533025Z",
            "url": "https://files.pythonhosted.org/packages/77/ed/cb2bcddf694c9a597a0e85651d994d0acf55b8c385c13a4a343cb7e102c9/sgtpyutils-1.19.21.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-25 16:25:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "serfend",
    "github_project": "sgtpyutils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "scidatetime",
            "specs": [
                [
                    ">=",
                    "1.19.18"
                ]
            ]
        },
        {
            "name": "pycryptodome",
            "specs": []
        },
        {
            "name": "colorlog",
            "specs": []
        },
        {
            "name": "openpyxl",
            "specs": [
                [
                    ">=",
                    "3.1.0"
                ]
            ]
        },
        {
            "name": "argparse",
            "specs": []
        },
        {
            "name": "httpx",
            "specs": []
        },
        {
            "name": "redis",
            "specs": []
        },
        {
            "name": "fake-useragent",
            "specs": []
        },
        {
            "name": "six",
            "specs": []
        },
        {
            "name": "pathlib2",
            "specs": []
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    ">=",
                    "4.9.0"
                ]
            ]
        }
    ],
    "lcname": "sgtpyutils"
}
        
Elapsed time: 0.24360s