import urllib.request, urllib.parse, urllib.error import ssl import xml.etree.ElementTree as PT ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE while True: url= input('Enter Location: ') print('Retrieving', url) uh = urllib.request.urlopen(url, context=ctx) data = uh.read() print('Retrieved', len(data), 'characters') tree=PT.fromstring (uh.read()) print (tree) break #My code for json is: <pre lang="Python"> import urllib.request, urllib.parse, urllib.error import ssl import json import requests ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE while True: url= input('Enter Location: ') print('Retrieving', url) r = requests.get(url, auth=('user', 'pass')) m=r.json() print (m) break
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)