【问题标题】:VIPTELA SDWAN API call issueVIPTELA SDWAN API 调用问题
【发布时间】:2020-10-22 08:54:25
【问题描述】:

在调用 API 方面需要您的专家建议。

我试图构建一个脚本来调用 Viptela SDWAN 中的设备信息。在我的家庭实验室脚本按预期工作,但是当我将 URL 更改为托管在 AWS 上的 live office Vmanage 时,它​​给了我错误并且脚本无法登录。但是通过 Internet Explorer 我能够登录到 Vmanage GUI。

下面是我得到的配置和错误消息。任何建议都会有所帮助。

错误:

Traceback (most recent call last):
File "C:/Users/XXXXXXX/Desktop/New folder (2)/apicallproject.py", line 123, in <module>
my_login()
File "C:/Users/XXXXXXX/Desktop/New folder (2)/apicallproject.py", line 24, in my_login
response = session.post(url=login_url, data=login_credentials, verify=false)
NameError: name 'false' is not defined

Process finished with exit code 1

+++++++++++++++++验证设置为真++++++++++++++++++++++

Traceback (most recent call last):
File "C:/Users/XXXXXXX/Desktop/New folder (2)/apicallproject.py", line 123, in <module>
my_login()
File "C:/Users/XXXXXXXX/Desktop/New folder (2)/apicallproject.py", line 24, in my_login
response = session.post(url=login_url, data=login_credentials, verify=true)
NameError: name 'true' is not defined

Process finished with exit code 1

以下是在我家 LAB 中运行良好的 python 脚本:-

ur = input ("Enter the path to Vmanage :")

name = input("Please enter your user name:")
passw = input("Please enter your password:")

def my_login():


login_url = '%s/j_security_check'%ur
login_credentials = {'j_username': name, 'j_password': passw}

session = requests.session()

response = session.post(url=login_url, data=login_credentials, verify=false)

if b`'<html>'` in response.content:

print('Login Failed')

else:

print('Login Success')

【问题讨论】:

  • 配置格式没问题,这是由于复制过去的代码。此代码在我的家庭实验室中运行良好,但在实时服务器上运行时出现错误

标签: api python-requests kentico cisco-jtapi


【解决方案1】:

使用TrueFalse 应该可以。可能是因为python版本不同。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-31
    • 2016-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多