Sample code for 30+ languages & platforms
Chilkat2-Python

Load XML from a Remote URL

Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xml

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

# This example assumes the Chilkat HTTP API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = chilkat2.Http()
sbXml = chilkat2.StringBuilder()

# Download the XML from the URL into sbXml
success = http.QuickGetSb("https://www.chilkatsoft.com/hamlet.xml",sbXml)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

xml = chilkat2.Xml()

# Load the XML contained in sbXml
success = xml.LoadSb(sbXml,True)
if (success == False):
    print(xml.LastErrorText)
    sys.exit()

print("Success.")