I'm pulling data from an API with the following:
url = "http://sitename"
response = requests.get(url)
data = response.text
print (data)
I get the output of raw xml, below is the browser output:
<projects count="8" href="/httpAuth/app/rest/projects/">
<project id="_Root" name="" description="" href="" webUrl=""/>
<project id="_Root1" name="" description="" href="" webUrl=""/>
<project id="_Root2" name="" description="" href="" webUrl=""/>
<project id="_Root3" name="" description="" href="" webUrl=""/>
<project id="_Root4" name="" description="" href="" webUrl=""/>
<project id="_Root5" name="" description="" href="" webUrl=""/>
<project id="_Root6" name="" description="" href="" webUrl=""/>
<project id="_Root7" name="" description="" href="" webUrl=""/>
</projects>
How do I get each rows information into usable form, such as looping through the list for each project id I pull the id/name/desc/href of each and store it?
I tried doing an conversion to json in the accept headers section for requests.get() but it still spit back xml data so I think I'm stuck working with this content structure.