Ich versuche billingInfo für eine Google-Cloud-Projekt zu bekommen Python 3.6 ich mit Anfrage bis zur Abrechnung API getan haben, aber die Antwort ist nicht zu erwarten, Wie Google in der Dokumentation Billing Api sagt, dass es zurückgibt Name, ProjectId, billingAccountName & billingEnabled. Aber es gibt nur Name und projectId auch für ein Projekt zurück, das nicht mit einem Rechnungskonto verknüpft ist. Hier ist mein Code:Google Cloud Billing API Python
projectName = form.cleaned_data['project_id']
# Get billing Info of selected project
auth = getauth()
service = discovery.build('cloudbilling', 'v1', http=auth, cache_discovery=False)
name = 'projects/' + projectName
billing_request = service.projects().getBillingInfo(name=name,)
billing_response = billing_request.execute()
data = billing_response
print(json.dumps(data))
if data['name']:
return HttpResponse(json.dumps(data), content_type='application/json')
else:
data = []
return HttpResponse(json.dumps(data), content_type='application/json')
und es gibt die Antwort wie:
{ "name": "Projekte/Docker-184805/billingInfo", "projectId": "Docker-184805"}
Auch die Fakturierung ist für dieses Projekt nicht aktiviert.
Wie kann ich die richtigen Rechnungsinformationen für ein Projekt auf Google Cloud-Plattform mit API Python-Client erhalten?
Hilf mir bitte!
Vielen Dank im Voraus!