I was trying with the below code to get groups and users in that group.. but i am getting null output with success code! Is that right way to follow the url pattern to get users?
import requests import base64 import json import time from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) NETWORK_GROUP ='READONLY' NETWORK_GROUP_MEMBERS = 'username' def main(): try: url = ("https:XXXXXX:1234/api/objects/network/group/") #headers = {"Authorization": "Basic %s" % SOPHOS_TOKEN , 'Content-Type': 'application/json'} headers={ 'content_type': 'application/json' } obj = {"name": NETWORK_GROUP, "members":NETWORK_GROUP_MEMBERS} response = requests.get(url, verify=False, headers = headers, json=obj, auth=('username', 'pswrd')) time.sleep(5) print(response) # getting 200 success code print(response.json()) # printing [] null output except Exception as e: print(e) if __name__ == '__main__': main()
This thread was automatically locked due to age.