为什么我在pycharm中使用curl得到无效语法



我是Python的新手,我正在努力学习ciso/github的基本编程课程。我逐字逐句地遵循一些指令,实际上是从一些示例代码中粘贴的cun,但我仍然会遇到语法错误。有人能告诉我出了什么问题吗她是我的代码

curl -k -x "https://10.85.116.30:443/restconf/data/Cisco-IOS-XE-native:native/logging/monitor/severity" 
-H 'Accept: application/yang-data+json' 
-u 'admin:admin'
File "<input>", line 1
curl -k -x "https://10.85.116.30:443/restconf/data/Cisco-IOS-XE-native:native/logging/monitor/severity" 
^
SyntaxError: invalid syntax
^

您编写了一个bash脚本。不是蟒蛇。因此出现语法错误。curl是一个CLI程序。了解如何通过python运行CMD/CLI命令。或者使用python中的"requests"模块发送HTTP请求。

请求模块-https://requests.readthedocs.io/en/master/

在Python中执行CLI-如何从Python执行程序或调用系统命令?

最新更新