Yuanfen Python Library
Project description
Yuanfen Python Library
build && upload
$ poetry build
$ poetry publish
Config
Support .json, .yaml, .ini files. Support auto reloading while config file changes.
config_json = Config("configs/config.json")
config_yaml = Config("configs/config.yaml")
config_ini = Config("configs/config.ini")
print(config_ini["app"]["config_a"])
print(config_yaml["movie"]["name"])
Logger
Stream and TimedRotatingFile handlers for logging.
logger = Logger(name="my-logger", level=logging.INFO)
logger.debug("debug log")
logger.info("info log")
logger.warning("warning log")
logger.error("error log")
BaseResponse, SuccessResponse, ErrorResponse
Response models for fastapi.
import uvicorn
from fastapi import FastAPI
from yuanfen import SuccessResponse
app = FastAPI()
@app.get("/health-check")
def health_check():
return SuccessResponse(data="OK")
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)
time
from yuanfen import time
time.format(dt=datetime.now(), format="%Y-%m-%dT%H:%M:%S")
time.parse(dt_string="2023-11-25T10:51:19", format="%Y-%m-%dT%H:%M:%S")
time.format_duration(90)
GroupRobot
Webhook group robot
robot = GroupRobot(webhook="your robot's webhook path")
robot.send(data)
hash
from yuanfen import hash
get_file_hash("path/to/file")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yuanfen-2024.9.11.2.tar.gz
(7.8 kB
view details)
Built Distribution
File details
Details for the file yuanfen-2024.9.11.2.tar.gz
.
File metadata
- Download URL: yuanfen-2024.9.11.2.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe63c4531882976fe138cb21d2a96880e63b4584791b224df51ffdb2874e586c |
|
MD5 | f043922a30aa14ef6871b945d7e75043 |
|
BLAKE2b-256 | efebfc240b235f4578f84c35cd789c5da39930bca06f77372ceafe49f3457da5 |
File details
Details for the file yuanfen-2024.9.11.2-py3-none-any.whl
.
File metadata
- Download URL: yuanfen-2024.9.11.2-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5215e1272ae2d5b7892d47124bf9f42a46aa0bf7209c3a6eb91cc4ad35c0932 |
|
MD5 | c04b9ababb025b2e2defa257fb0ff74a |
|
BLAKE2b-256 | bd92550b6dbb2bc9b6ed23f98d3d5f9e98bf65ad83172f816e643ebc0bf0907f |