﻿  #!C:\Python\Python311\python.exe
# -*- coding: utf-8 -*-
# get_single_user_by_id.py .

import sys
import requests
import json
sys.path.insert(0, '../..')
sys.path.insert(0, '..')
try:
    from consts import clC
    from .consts import clC

except Exception as inst:
    # print ("Content-type: text/html ;\n\n")
    # print
    # print("client_mqtt import      Exception")
    # m = type(inst)
    # print(type(inst))  # the exception type
    # print(inst.args)  # arguments stored in .args
    # print(inst)  # __str__ allows args to be printed directly,
    pass


 # Basic Authentication (username and password)

# http://localhost:3000/api/dashboards/home
server = "http://localhost:3000"
# Example 1: Get default Home dashboard:
url = server + "/api/users/2"
# url = "http://localhost:3000/api/datasources"
# url = server + "/api/dashboards/db"
headers = {
    #"Authorization":"Bearer "+clC.g("API_KEY"),
    "Content-Type":"application/json",
    "Accept": "application/json"
}
# GET /api/users/1 HTTP/1.1
# Accept: application/json
# Content-Type: application/json
# Authorization: Basic YWRtaW46YWRtaW4=

r = requests.get(url = url,
                   headers = headers,
                   # data = json.dumps(new_user),
                    auth = (clC.USER_ADMIN, clC.PASS_ADMIN ),
                     verify=False)
print(r.json())