Files
python----/api.py
T
2025-10-20 12:32:18 +08:00

43 lines
872 B
Python

from requests import get, post, put, delete
import random
# v1.jinrishici.com/all.json
def apiSentence():
data = get("https://v1.hitokoto.cn").json()
return data
def cat():
data = get("https://api.thecatapi.com/v1/images/search?size=full").json()
result = data[0]["url"]
return result
def dog():
data = get("https://api.thedogapi.com/v1/images/search?size=full").json()
result = data[0]["url"]
return result
def pic():
data = get("https://api.vvhan.com/api/bing?type=json&rand=sj").json()
result = data["data"]["url"]
return result
def randomPic():
func = random.choice([cat, dog, pic])
data = func()
return data
def getEmoji():
data = get("https://api.vvhan.com/api/emoji?type=json").json()
return data
def getShi():
data = post("http://v1.jinrishici.com/all.json").json()
return data