diff --git a/edsm/systemApi.py b/edsm/systemApi.py index 8cb5d9b..aee8b92 100644 --- a/edsm/systemApi.py +++ b/edsm/systemApi.py @@ -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 \ No newline at end of file