Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
api = self.api_projects_url
elif category == CATEGORY_METRIC:
# Get all metrics definitions and then find the values for the current project
api_metrics = self.api_metrics_url
metrics = json.loads(self.fetch(api_metrics))
else:
raise ValueError(category + ' not supported in Crossminer')
if category == CATEGORY_PROJECT:
logger.debug("Crossminer client calls APIv1: %s", api)
projects = self.fetch(api)
yield projects
else:
for metric in metrics:
metric_id = metric['id']
api = urijoin(self.api_projects_url, "/p/%s/m/%s" % (project, metric_id))
logger.debug("Crossminer client calls APIv1: %s", api)
print(api)
project_metric = self.fetch(api)
yield project_metric
def __init__(self, url, project=None, archive=None, from_archive=False):
super().__init__(url, archive=archive, from_archive=from_archive)
self.project = project
self.api_metrics_url = urijoin(self.base_url, "metrics")
self.api_projects_url = urijoin(self.base_url, "projects")
def messages(self, mailing_list, offset, max_messages=MAX_MESSAGES):
"""Fetch a set of messages from the given mailing list.
Given the mailing list identifier used by Gmane and a offset,
this method fetches a set of messages.
:param mailing_list: mailing list identifier on Gmane
:param offset: start to fetch from here
:param max_messages: maximum number of messages to fetch
"""
end_offset = offset + max_messages
resource = urijoin(mailing_list, offset, end_offset)
r = self.fetch(self.GMANE_DOWNLOAD_RTYPE, resource)
return r.content
def __init__(self, url, project=None, archive=None, from_archive=False):
super().__init__(url, archive=archive, from_archive=from_archive)
self.project = project
self.api_metrics_url = urijoin(self.base_url, "metrics")
self.api_projects_url = urijoin(self.base_url, "projects")