How to use the labgrid.external.hawkbit.HawkbitError function in labgrid

To help you get started, we’ve selected a few labgrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github labgrid-project / labgrid / labgrid / external / hawkbit.py View on Github external
def delete(self, endpoint: str):
        req = r.delete(
            self.url.format(
                endpoint=endpoint, host=self.host, port=self.port
            ),
            auth=(self.username, self.password),
        )
        if req.status_code != 200:
            raise HawkbitError(
                'Wrong statuscode, got {} instead of 200, with error {}'.
                format(req.status_code, req.json())
            )
github labgrid-project / labgrid / labgrid / external / hawkbit.py View on Github external
def get_endpoint(self, endpoint: str):
        headers = {'Content-Type': 'application/json;charset=UTF-8'}
        req = r.get(
            self.url.format(
                endpoint=endpoint, host=self.host, port=self.port
            ),
            headers=headers,
            auth=(self.username, self.password)
        )
        if req.status_code != 200:
            raise HawkbitError(
                'Wrong statuscode, got {} instead of 200, with error {}'.
                format(req.status_code, req.json())
            )
        return req.json()
github labgrid-project / labgrid / labgrid / external / hawkbit.py View on Github external
def post_json(self, endpoint: str, data: dict):
        headers = {'Content-Type': 'application/json;charset=UTF-8'}
        req = r.post(
            self.url.format(
                endpoint=endpoint, host=self.host, port=self.port
            ),
            headers=headers,
            auth=(self.username, self.password),
            json=data
        )
        if req.status_code != 200 and req.status_code != 201:
            raise HawkbitError(
                'Wrong statuscode, got {} instead of 200/201, with error {}'.
                format(req.status_code, req.json())
            )
        return req.json()
github labgrid-project / labgrid / labgrid / external / hawkbit.py View on Github external
def post(self, endpoint: str):
        req = r.post(
            self.url.format(
                endpoint=endpoint, host=self.host, port=self.port
            ),
            auth=(self.username, self.password),
        )
        if req.status_code != 200 and req.status_code != 201:
            raise HawkbitError(
                'Wrong statuscode, got {} instead of 200/201'.
                format(req.status_code)
            )