当前位置: 首页>后端>正文

flask默认method是get请求 如果app.route没有指定methods的话

flask默认method是get请求 如果app.route没有指定methods的话

flask 每种请求的 每种函数 的参数、方法、属性

requests 每种请求的 每种函数 的参数、方法、属性

get请求允许的输入类型为None或str

import requests

def get(input:str=None, url=None):
    url = str(url) if url else "http://localhost:5000/get"
    response = requests.get(url, params=input)
    if response.status_code == 200:
        result = response.json()
        return result
    else:
        return response


if __name__ == "__main__":
    input = None
    url = None
    result = get(input, url=url)
    print(result)

错误405 请求方式错误 比如发送post请求 但url只允许get请求

import pandas as pd
import datetime

df = pd.DataFrame()
df["col1"] = []  # empty if [] or None but not [None] like

# df["col2"] = df["col1"] + datetime.datetime.now()
# df["col2"] = df["col1"] + pd.Timestamp.now()
# TypeError: Concatenation operation is not implemented for NumPy arrays, use np.concatenate() instead. Please do not rely on this error; it may not be given on all Python implementations.
# 空表不允许
# 需 not df.empty

https://www.xamrdz.com/backend/3r71931220.html

相关文章: