Add traffic endpoint for System API

This commit is contained in:
Kevin 2022-02-26 19:45:07 -05:00
parent be52fae1c3
commit 608d4bfe10

View file

@ -41,3 +41,42 @@ class Bodies(base.ApiEndpoint):
json = cls.query({'systemId': str(systemId)})
return json
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
def getTrafficbyId(cls, systemId):
"""
Requests information about traffic in a system.
:param systemName: ID of the system in question
"""
json = cls.query({'systemId' : str(systemId)})
return json