本文整理匯總了Python中SettingsLibrary.getAddCarPersonUrl方法的典型用法代碼示例。如果您正苦於以下問題:Python SettingsLibrary.getAddCarPersonUrl方法的具體用法?Python SettingsLibrary.getAddCarPersonUrl怎麽用?Python SettingsLibrary.getAddCarPersonUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SettingsLibrary
的用法示例。
在下文中一共展示了SettingsLibrary.getAddCarPersonUrl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: addCarPerson
# 需要導入模塊: import SettingsLibrary [as 別名]
# 或者: from SettingsLibrary import getAddCarPersonUrl [as 別名]
def addCarPerson(hostname,port,numberOfCarPersons):
#FOR RPC TO WORK PROPERLY THE FIRST ENTRY SHOULD BE VIA RESTCONF
if(numberOfCarPersons==0):
payload = SettingsLibrary.add_car_person_template.substitute(Id=str(numberOfCarPersons),personId="user"+str(numberOfCarPersons))
# Send the POST request REST CONF
resp = UtilLibrary.nonprintpost(SettingsLibrary.getAddCarPersonUrl(hostname,port),"admin", "admin",payload)
return
for x in range(1, numberOfCarPersons+1):
strId = str(x)
payload = SettingsLibrary.add_car_person_template.substitute(Id=strId,personId="user"+strId)
# Send the POST request REST CONF
resp = UtilLibrary.post(SettingsLibrary.getAddCarPersonUrl(hostname,port),"admin", "admin",payload)
print("payload formed after template substitution=")
print(payload)
print("the response of the POST to add car_person=")
print(resp)
print("getting the car_persons for verification")
resp=getCarPersonMappings(hostname,port,0)
示例2: addCarPerson
# 需要導入模塊: import SettingsLibrary [as 別名]
# 或者: from SettingsLibrary import getAddCarPersonUrl [as 別名]
def addCarPerson(hostname, port, numberOfCarPersons):
"""This method is not exposed via commands as only getCarPersons is of interest
addCarPerson entry happens when buyCar is called
<note>
To enable RPC a non-user input car-person entry is created with personId=user0
</note>
"""
# FOR RPC TO WORK PROPERLY THE FIRST ENTRY SHOULD BE VIA RESTCONF
if (numberOfCarPersons == 0):
payload = SettingsLibrary.add_car_person_template.substitute(
Id=str(numberOfCarPersons), personId="user" + str(numberOfCarPersons))
# Send the POST request REST CONF
resp = UtilLibrary.nonprintpost(SettingsLibrary.getAddCarPersonUrl(hostname, port), "admin", "admin", payload)
return resp
for x in range(1, numberOfCarPersons + 1):
strId = str(x)
payload = SettingsLibrary.add_car_person_template.substitute(Id=strId, personId="user" + strId)
# Send the POST request REST CONF
resp = UtilLibrary.post(SettingsLibrary.getAddCarPersonUrl(hostname, port), "admin", "admin", payload)
print("payload formed after template substitution=")
print(payload)
print("the response of the POST to add car_person=")
print(resp)
print("getting the car_persons for verification")
resp = getCarPersonMappings(hostname, port, 0)
# TBD detailed validation
return resp