Speichern Sie die XML -Antwort von Get Call mit PythonPython

Python-Programme
Anonymous
 Speichern Sie die XML -Antwort von Get Call mit Python

Post by Anonymous »

Wie kann ich die XML -API -Antwort auf eine .xml -Dateien speichern? Oder dankt es, so kann ich es analysieren, bevor ich die Antwort analysiere. < /P>

Code: Select all

import requests
r = requests.get('url',  auth=('user', 'pass'))
Ich habe mir eine ähnliche Frage für JSON angesehen: https://stackoverflow.com/a/17519020/4821590

Code: Select all

import requests
import json
solditems = requests.get('https://github.com/timeline.json') # (your url)
data = solditems.json()
with open('data.json', 'w') as f:
json.dump(data, f)

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post