Adding pending certificate metric. (#473)

This commit is contained in:
kevgliss
2016-11-01 14:24:45 -07:00
committed by GitHub
parent d99681904e
commit a6360ebfe5
3 changed files with 29 additions and 41 deletions

View File

@ -188,6 +188,25 @@ class VerisignIssuerPlugin(IssuerPlugin):
response = self.session.post(url, headers={'content-type': 'application/x-www-form-urlencoded'})
return handle_response(response.content)['Response']['Order']
def get_pending_certificates(self):
"""
Uses Verisign to fetch the number of certificate awaiting approval.
:return:
"""
url = current_app.config.get("VERISIGN_URL") + '/reportingws'
end = arrow.now()
start = end.replace(days=-7)
data = {
'reportType': 'summary',
'certProductType': 'Server',
'startDate': start.format("MM/DD/YYYY"),
'endDate': end.format("MM/DD/YYYY"),
}
response = self.session.post(url, data=data)
return response.json()['certificateSummary'][0]['Pending']
class VerisignSourcePlugin(SourcePlugin):
title = 'Verisign'