功能:细节修改

- 一言字数
 - web 模式缓存
This commit is contained in:
周中平 2023-11-06 14:20:49 +08:00
parent c9ef0ccca3
commit 69f883f0a5
Signed by: zhouzhongping
GPG Key ID: 6666822800008000
2 changed files with 4 additions and 1 deletions

View File

@ -1,9 +1,12 @@
from functools import lru_cache
from loguru import logger from loguru import logger
import models import models
import scraper import scraper
@lru_cache(maxsize=None)
class Generator: class Generator:
def __init__(self, rss): def __init__(self, rss):

View File

@ -109,7 +109,7 @@ def get_yiyan():
:return:一言 :return:一言
""" """
try: try:
response = requests.get("https://v1.hitokoto.cn/?c=d&min_length=18&max_length=24&encode=text", response = requests.get("https://v1.hitokoto.cn/?c=d&min_length=16&max_length=20&encode=text",
timeout=30) # Set timeout to 5 seconds timeout=30) # Set timeout to 5 seconds
if response.status_code == 200: if response.status_code == 200:
return response.text return response.text