'find difference between user in multiple list
need help to get difference between user in multiple group...
from os import getenv
def fetch_admin_member(ip, headers): #function to iterate over each switch
list_group= []
url = f'https://{ip}:8443/api/v1/data/switch/core/aaa/group?config=true'
response = requests.get(url, headers=headers, verify=False).json()
list_group.append(response[0]["user"])
print(sorted(list_group))
def main(): #fetch the list of switch
cf = connect_to_switch(getenv("TOKEN"), url='https://netbox.corp.nutanix.com')
switch_ob = cf.dcim.devices.filter(q='sw', status='active', cf_device_ha_state='active')
switch_name = [item.name for item in switch_ob ]
switch_ip = [item.primary_ip.address.split("/")[0] for item in switch_ob]
headers = {
'Cookie': f'session_cookie={getenv("BCF_TOKEN")}',
'Accept': 'application/json',
'Content-Type': 'application/json'
}
for ip in switch_ip:
fetch_admin_member(ip, headers)
if __name__ == '__main__':
main()
above is the code to fetch all switch and find out of group of user so need to help to store all list and find difference of that group in list....
i'm getting o/p for above code is like:
[['kan', 'craig', 'tekear', 'mike']]
[['jose', 'randy', 'tekear', 'mike']]
[['dang', 'mike', 'craig', 'kan']]
[['mike', 'randy', 'serge', 'kan']]
Solution 1:[1]
use a session variable like this
As you postet not enough information i am guessing the parameter you send
BEGIN
SELECT price INTO @totalUSD FROM rpsprice ORDER BY timestamp DESC LIMIT 1;
UPDATE info_airdrop set unlockedRPS = unlockedRPS + diarioUSD / rps,
unlockedUSD = unlockedUSD + diarioUSD,
dias = dias + 1
WHERE unlockedUSD < @totalUSD;
END //
If you need more variables
BEGIN
SELECT price, diarioUSD,rds INTO @totalUSD,@diarioUSD,@rds FROM rpsprice ORDER BY timestamp DESC LIMIT 1;
UPDATE info_airdrop set unlockedRPS = unlockedRPS + @diarioUSD / @rds,
unlockedUSD = unlockedUSD + @diarioUSD,
dias = dias + 1
WHERE unlockedUSD < @totalUSD;
END //
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | nbk |
