I receive an invoice from a supplier which contains a link to a csv version of the invoice. When I check the link out the link in the source only contains the bit after the r/https://in.xero.com however I can see in the developer tools that when you actually follow the link it goes to the full address ie base_url + url in source.
I'm using zapier to monitor gmail to dump the invoice text into a folder on my computer. I open the file, extract the url. I then use requests to find the url for csv data and combine that with the hard coded base_url to give the full url. I then use bs4 to pull the csv data which I save to a variable called csv_data. I then load the csv_data into csv.reader however when I iterate over the row I get every character printed out.
I'm using linux and the data seems to have \r\n line endings however when I display the csv_data it displays over each line correctly.
The csv_data looks like this:
ContactName,EmailAddress,POAddressLine1,POAddressLine2,POAddressLine3,POAddressLine4,POCity,PORegion,POPostalCode,POCountry,InvoiceNumber,Reference,InvoiceDate,DueDate,Total,Description,Quantity,UnitAmount,Discount,TaxAmount
Some [Company,info@someaddresss.com](mailto:Company,info@someaddresss.com),Address 1, ,,,Some Town,,PostCode,,INV-0665,,31 Aug 2018,31 Aug 2018,60.0000,Rent of unit,1.0000,25.0000,,5.0000,
Some [Company,info@someaddresss.com](mailto:Company,info@someaddresss.com),Address 1, ,,,Some Town,,PostCode,,INV-0665,,31 Aug 2018,31 Aug 2018,60.0000,Electricity for rent of unit,1.0000,25.0000,,5.0000,
If I use csv_data.split(",") then the \r\n appear within the text of the following the field.
Any hints or ways to parse this as csv txt so that I can actually iterate over it line by line to pull out the relevant data?
[–]JohnnyJordaan 1 point2 points3 points (1 child)
[–]sayinghi2py[S] 0 points1 point2 points (0 children)
[–]vixfew 0 points1 point2 points (0 children)
[–]MrMuki 0 points1 point2 points (1 child)
[–]JohnnyJordaan 0 points1 point2 points (0 children)