这是我的Resource
类的get方法:
from flask_restful import Resource
import subprocess
CMD = ['some', 'cmd' ]
class MyResource(Resource):
def get(self):
try:
completed_process = subprocess.run(CMD, check=True,
capture_output=True)
....
在上面的代码中,我现在可以检索(并打印)传入的XGET
请求的IP?
我知道this的答案,但是它没有指出如何使用flask_restful
和Resource
类来解决这个问题。