2019-10-04 00:00:17 +02:00
|
|
|
import requests
|
|
|
|
from . import base
|
|
|
|
from . import exception
|
|
|
|
from . import models
|
|
|
|
|
|
|
|
class Bodies(base.ApiEndpoint):
|
|
|
|
"""
|
2019-11-02 00:58:48 +01:00
|
|
|
The “bodies” endpoint of the “system” API
|
2019-10-04 00:00:17 +02:00
|
|
|
|
|
|
|
:attribute url: the API endpoint URL
|
|
|
|
"""
|
|
|
|
|
|
|
|
url = base.ApiEndpoint.url + "system-v1/bodies"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def query(cls, params):
|
|
|
|
try:
|
|
|
|
json = super().query(params)
|
|
|
|
except exception.NotFoundError:
|
|
|
|
raise exception.SystemNotFoundError(params)
|
|
|
|
return json
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def getBodies(cls, systemName):
|
|
|
|
"""
|
|
|
|
Requests information about the bodies in a system.
|
|
|
|
|
|
|
|
:param systemName: name of the system in question
|
|
|
|
"""
|
|
|
|
|
2019-12-26 23:53:38 +01:00
|
|
|
json = cls.query({'systemName': systemName})
|
2019-10-04 00:00:17 +02:00
|
|
|
return json
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def getBodiesById(cls, systemId):
|
|
|
|
"""
|
|
|
|
Requests information about the bodies in a system.
|
|
|
|
|
|
|
|
:param systemId: ID of the system in question
|
|
|
|
"""
|
|
|
|
|
2019-12-26 23:53:38 +01:00
|
|
|
json = cls.query({'systemId': str(systemId)})
|
2019-10-04 00:00:17 +02:00
|
|
|
return json
|
2022-02-27 01:45:07 +01:00
|
|
|
|
|
|
|
class Traffic(base.ApiEndpoint):
|
|
|
|
"""
|
|
|
|
The "traffic" endpoint of the "system" API
|
|
|
|
|
|
|
|
:attribute url: the API endpoint URL
|
|
|
|
"""
|
|
|
|
|
|
|
|
url = base.ApiEndpoint.url + "system-v1/traffic"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def query(cls, params):
|
|
|
|
try:
|
|
|
|
json = super().query(params)
|
|
|
|
except exception.NotFoundError:
|
|
|
|
raise exception.SystemNotFoundError(params)
|
|
|
|
return json
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def getTraffic(cls, systemName):
|
|
|
|
"""
|
|
|
|
Requests information about traffic in a system.
|
|
|
|
|
|
|
|
:param systemName: name of the system in question
|
|
|
|
"""
|
|
|
|
|
|
|
|
json = cls.query({'systemName': systemName})
|
|
|
|
return json
|
|
|
|
|
|
|
|
@classmethod
|
2022-03-02 20:43:56 +01:00
|
|
|
def getTrafficById(cls, systemId):
|
2022-02-27 01:45:07 +01:00
|
|
|
"""
|
|
|
|
Requests information about traffic in a system.
|
|
|
|
|
|
|
|
:param systemName: ID of the system in question
|
|
|
|
"""
|
|
|
|
|
|
|
|
json = cls.query({'systemId' : str(systemId)})
|
2022-03-11 23:54:54 +01:00
|
|
|
return json
|