I need to add an expiry date to self signed guest accounts on the Meraki cloud authentication portal. I am using the "PUT/networks/{networkId}/merakiAuthUsers/{merakiAuthUserId}"
This returns
"name": "Miles Meraki", "password": "secret", "emailPasswordToUser": false, "authorizations": [ { "ssidNumber": 1, "expiresAt": "never" I need to change this to a date and time
"
The authorizations is a list but but it only appears to have 1 index 0
I can find no way to extract the "expiresAt" dictionary value. My Tests in PyCharm
import datetime
import json
import itertools
from datetime import date
from datetime import datetime
from datetime import timedelta
MerakiUser = {
"name": "Russell Sage",
"password:": "Test123",
"emailPasswordToUser": False,
"authorizations" : [
{
"ssidNumber": 1,
"expiresAt": "never"
}
]
}
name = MerakiUser["name"]
print(name)
expiryDate = MerakiUser["authorizations"]
print(expiryDate)
print(type(expiryDate))
print(expiryDate.pop(1))
Traceback (most recent call last):
Dictionary.py", line 23, in <module>
print(expiryDate.pop(1))
IndexError: pop index out of range
Russell Sage
[{'ssidNumber': 1, 'expiresAt': 'never'}]
<class 'list'>
Process finished with exit code 1
Any assistance greatly received