I am using the requests module to pull data from a website. The data is being passed as a pipe delimited string. The data has headings and each request can have multiple rows returned.
The data looks as follows for example: name|surname|ID|product David|John|1|apple Paul|Smith|2|orange .....
I need to be able to access each variable within the above string so that I can pass it through to another API. For example, the API call will need to loop through each line in the above string:
for line in x
post = {
"name": line.["name"],
"surname": line.["surname"],
"ID": line.["ID"],
"product": line.["product"]
}
I would like to run the code using a cron job, so I would prefer to avoid creating a file and then working with the file.
TIA