Azure / Azure/azure-rest-api-specs-examples
[Sample Issue] Output format is wrong
- Dominant language
- No language data
- Stars
- 40
- Forks
- 23
- Avg merge
- 23h 36m
- Merged PRs (30d)
- 172
Description
### Link to sample
https://learn.microsoft.com/en-us/rest/api/billing/invoices/list-by-billing-profile?view=rest-billing-2020-05-01&tabs=Python
### Library name and version
azure.mgmt.billing 6.0.0
### Language of the Sample
- [ ] C#/.NET
- [ ] Java
- [ ] JavaScript/TypedScript
- [X] Python
- [ ] Golang
- [ ] Other - Please specify in Issue details field
### Sample Issue Type
- [ ] Sample not working
- [ ] Sample missing
- [X] Do not understand sample
### Issue details
I run this code:
```
from azure.mgmt.billing import BillingManagementClient
from azure.identity import ClientSecretCredential
credentials = ClientSecretCredential(
tenant_id="",
client_id="",
client_secret="",
api_version="2020-05-01"
)
client = BillingManagementClient(
credential=credentials,
subscription_id='',
)
response = client.invoices.list_by_billing_profile(
billing_account_name="",
billing_profile_name="",
period_start_date="2024-02-01",
period_end_date="2024-02-29",
)
for item in response:
print(item)
```
I don't get an invoice in return.
### Expected behavior
An invoice description in JSON format.
### Actual behavior
The sample code give me this output:
```
{'additional_properties': {}, 'id': '/providers/Microsoft.Billing/billingAccounts//invoices/', 'name': 'G040589327', 'type': 'Microsoft.Billing/billingAccounts/invoices', 'due_date': datetime.datetime(2024,
4,
4,
6,
7,
13,
95965, tzinfo=), 'invoice_date': datetime.datetime(2024,
3,
5,
6,
7,
13,
95965, tzinfo=), 'status': 'Due', 'amount_due': , 'azure_prepayment_applied': , 'billed_amount': , 'credit_amount': , 'free_azure_credit_applied': , 'sub_total': , 'tax_amount': , 'total_amount': , 'invoice_period_start_date': datetime.datetime(2024,
2,
1,
0,
0, tzinfo=), 'invoice_period_end_date': datetime.datetime(2024,
2,
29,
23,
59,
59,
999999, tzinfo=), 'invoice_type': None, 'is_monthly_invoice': True, 'billing_profile_id': '/providers/Microsoft.Billing/billingAccounts//billingProfiles/', 'billing_profile_display_name': 'Formpipe Software Ltd', 'purchase_order_number': '', 'documents': [
], 'payments': [], 'rebill_details': None, 'document_type': 'Invoice', 'billed_document_id': None, 'credit_for_document_id': None, 'subscription_id': None
}
```
If I change to
```
for item in response:
print(item.serialize())
```
I get this output:
`{}`
### Reproduction Steps
Run the example.
### Environment
Windows 11
Python 3.11.2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.