<filename>app/plugins/hitokoto.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from random import randint
import json

import requests

from config import headers, cdn
from data import hitokoto_


def hitokoto():
    """一言"""
    # data = requests.get(cdn + 'hitokoto.json', headers=headers).json()
    # return data[randint(1, len(data))]
    with open(hitokoto_(), 'r') as ff:
        data = json.load(ff)
        return data[randint(1, len(data))]


def poem():
    """每日诗词"""
    _svg = '<svg xmlns="http://www.w3.org/2000/svg" height="22.0" width="342.5"><g><text text-anchor="start" ' \
           'letter-spacing="1.5" font-smoothing="antialiased" ' \
           'font-family="KaiTi,Segoe UI,Lucida Grande,Helvetica,Arial,Microsoft YaHei,FreeSans,' \
           'Arimo,Droid Sans,wenquanyi micro hei,Hiragino Sans GB,Hiragino Sans GB W3,sans-serif" ' \
           'font-size="{}" id="svg_1" y="20.0" x="0" stroke-width="0" stroke="#000" ' \
           'fill="#000000"></text></g></svg>'
    pass


def dog():
    """舔狗日记"""
    pass

<filename>app/plugins/hitokoto.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from random import randint
import json

import requests

from config import headers, cdn
from data import hitokoto_


def hitokoto():
    """一言"""
    # data = requests.get(cdn + 'hitokoto.json', headers=headers).json()
    # return data[randint(1, len(data))]
    with open(hitokoto_(), 'r') as ff:
        data = json.load(ff)
        return data[randint(1, len(data))]


def poem():
    """每日诗词"""
    _svg = '<svg xmlns="http://www.w3.org/2000/svg" height="22.0" width="342.5"><g><text text-anchor="start" ' \
           'letter-spacing="1.5" font-smoothing="antialiased" ' \
           'font-family="KaiTi,Segoe UI,Lucida Grande,Helvetica,Arial,Microsoft YaHei,FreeSans,' \
           'Arimo,Droid Sans,wenquanyi micro hei,Hiragino Sans GB,Hiragino Sans GB W3,sans-serif" ' \
           'font-size="{}" id="svg_1" y="20.0" x="0" stroke-width="0" stroke="#000" ' \
           'fill="#000000"></text></g></svg>'
    pass


def dog():
    """舔狗日记"""
    pass

#!/usr/bin/env python # -*- coding: utf-8 -*- 一言 # data = requests.get(cdn + 'hitokoto.json', headers=headers).json() # return data[randint(1, len(data))] 每日诗词 舔狗日记