Created
October 13, 2016 16:08
-
-
Save renatoliveira/2aa37a3ea302b4792c58489540edfbd0 to your computer and use it in GitHub Desktop.
Simple script to get a XML from a service and translate it to JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from json import dumps | |
from xmljson import parker as pk | |
from xml.etree.ElementTree import fromstring | |
endpoint = 'http://webserviceurlhere/number' | |
xml = requests.get(endpoint).text | |
result = dumps(pk.data(fromstring(xml))) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment