Hello
I'm new at python and trying to program something, where i grab data from a API and export the Output to a csv file. But i got problems to export the plain text.
The Code looks like that for the API-Request
#!/usr/bin/python
import requests
url = "
https://api.bexio.com/2.0/article"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer {}",
}
response = requests.request("GET", url, headers=headers)
print(response.text)
Response:
[{"id":2,"user_id":1,"article_type_id":1,"contact_id":null,"deliverer_code":"","deliverer_name":"","deliverer_description":"","intern_code":"","intern_name":"APITEST","intern_description":"","purchase_price":null,"sale_price":null,"purchase_total":null,"sale_total":null,"currency_id":1,"tax_income_id":3,"tax_id":3,"tax_expense_id":10,"unit_id":null,"is_stock":true,"stock_id":null,"stock_place_id":null,"stock_nr":1,"stock_min_nr":10,"stock_reserved_nr":0,"stock_available_nr":1,"stock_picked_nr":0,"stock_disposed_nr":0,"stock_ordered_nr":0,"width":null,"height":null,"weight":null,"volume":null,"html_text":null,"remarks":"","delivery_price":null,"article_group_id":null},{"id":3,"user_id":1,"article_type_id":1,"contact_id":null,"deliverer_code":"","deliverer_name":"","deliverer_description":"","intern_code":"","intern_name":"WARE","intern_description":"","purchase_price":"200.000000","sale_price":"500.000000","purchase_total":null,"sale_total":null,"currency_id":1,"tax_income_id":3,"tax_id":3,"tax_expense_id":10,"unit_id":null,"is_stock":false,"stock_id":null,"stock_place_id":null,"stock_nr":0,"stock_min_nr":0,"stock_reserved_nr":0,"stock_available_nr":0,"stock_picked_nr":0,"stock_disposed_nr":0,"stock_ordered_nr":0,"width":null,"height":null,"weight":null,"volume":null,"html_text":null,"remarks":"","delivery_price":null,"article_group_id":null},
Like i wrote, i want to export the output (Response) to a csv and i don't know how to make that. I tried that with pandas but it didn't work.
Thank u all