def main(): for name, url in SERVICE_URLS.iteritems(): metadata_url = url+'/$metadata' filename = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'metadata_xmls', "%s.xml"%name) r = requests.get(metadata_url) with open(filename, 'wb') as f: f.write(r.content)
def main(): for name, url in SERVICE_URLS.iteritems(): metadata_url = url + '/$metadata' filename = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'metadata_xmls', "%s.xml" % name) r = requests.get(metadata_url) with open(filename, 'wb') as f: f.write(r.content)
def main(): for name, url in SERVICE_URLS.iteritems(): metadata_url = url+'/$metadata' original_filename = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'metadata_xmls', "%s.xml"%name) try: r = requests.get(metadata_url) if r.status_code == 200: with open(original_filename, 'r') as f: original_xml = f.read() if r.content != original_xml: notify_xml_changed(name, url, original_xml, r.content) else: logger.info('service %s metadata was not changed'%name) else: notify_error(name, url, 'invalid status code', r.status_code) except RequestException, e: notify_error(name, url, 'request exception', str(e))
def main(): for name, url in SERVICE_URLS.iteritems(): metadata_url = url + '/$metadata' original_filename = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'metadata_xmls', "%s.xml" % name) try: r = requests.get(metadata_url) if r.status_code == 200: with open(original_filename, 'r') as f: original_xml = f.read() if r.content != original_xml: notify_xml_changed(name, url, original_xml, r.content) else: logger.info('service %s metadata was not changed' % name) else: notify_error(name, url, 'invalid status code', r.status_code) except RequestException, e: notify_error(name, url, 'request exception', str(e))