# Path: extras/python/iotsaControl/consts.py
# class UserIntervention(Exception):
#     pass
# 
# class IotsaError(RuntimeError):
#     pass
# 
# class CoapError(Exception):
#     pass
# 
# VERBOSE=[]


from future import standard_library
from builtins import str
from builtins import object
from .consts import UserIntervention, IotsaError, CoapError, VERBOSE
import sys
import socket
import time
import urllib.parse
import urllib.request
import json as jsonmod
import coapthon.client.helperclient
import coapthon.defines
import requests
import urllib3
        self.baseURL = baseURL
        self.noverify = noverify
        self.bearer = bearer
        self.auth = auth
        
    def close(self):
        pass

    def get(self, endpoint, json=None):
        return self.request('GET', endpoint, json=json)
        
    def put(self, endpoint, json=None):
        return self.request('PUT', endpoint, json=json)
        
    def post(self, endpoint, json=None, files=None):
        assert files is None or json is None
        return self.request('POST', endpoint, json=json, files=files)
        
    def request(self, method, endpoint, json=None, files=None):
        headers = {}
        if self.bearer:
            headers['Authorization'] = 'Bearer '+self.bearer
        if endpoint[:1] == '/':
            url = self.baseURL + endpoint[1:]
        else:
            url = self.baseURL + 'api/' + endpoint
        if VERBOSE: 
            print('REST %s %s' % (method, url))
            if self.auth:
                print('auth', self.auth)

# Path: extras/python/iotsaControl/consts.py
# class UserIntervention(Exception):
#     pass
# 
# class IotsaError(RuntimeError):
#     pass
# 
# class CoapError(Exception):
#     pass
# 
# VERBOSE=[]


# Path: extras/python/iotsaControl/protocols.py
from future import standard_library
from builtins import str
from builtins import object
from .consts import UserIntervention, IotsaError, CoapError, VERBOSE
import sys
import socket
import time
import urllib.parse
import urllib.request
import json as jsonmod
import coapthon.client.helperclient
import coapthon.defines
import requests
import urllib3

        self.baseURL = baseURL
        self.noverify = noverify
        self.bearer = bearer
        self.auth = auth
        
    def close(self):
        pass

    def get(self, endpoint, json=None):
        return self.request('GET', endpoint, json=json)
        
    def put(self, endpoint, json=None):
        return self.request('PUT', endpoint, json=json)
        
    def post(self, endpoint, json=None, files=None):
        assert files is None or json is None
        return self.request('POST', endpoint, json=json, files=files)
        
    def request(self, method, endpoint, json=None, files=None):
        headers = {}
        if self.bearer:
            headers['Authorization'] = 'Bearer '+self.bearer
        if endpoint[:1] == '/':
            url = self.baseURL + endpoint[1:]
        else:
            url = self.baseURL + 'api/' + endpoint
        if VERBOSE: 
            print('REST %s %s' % (method, url))
            if self.auth:
                print('auth', self.auth)

            if headers: