Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <root>
  2. <header>
  3. <ecode>0</ecode>
  4. <edesc/>
  5. </header>
  6. <body>
  7. <Prof>
  8. <nom>nombre</nom>
  9. <rut>rut</rut>
  10. <urlAg>url</urlAg>
  11. <fechTit>fecha</fechTit>
  12. <uni>universidad</uni>
  13. <EspeProf>
  14. <Esp>
  15. <nomEsp>especialidad 1</nomEsp>
  16. </Esp>
  17. </EspeProf>
  18. <CMProf>
  19. <CM>
  20. <nomCM>centro medico</nomCM>
  21. </CM>
  22. </CMProf>
  23. </Prof>
  24. <Prof>
  25. <nom>nombre</nom>
  26. <rut>rut</rut>
  27. <urlAg>url</urlAg>
  28. <fechTit>fecha </fechTit>
  29. <uni>universidad</uni>
  30. <EspeProf>
  31. <Esp>
  32. <nomEsp>especialidad 1</nomEsp>
  33. </Esp>
  34. <Esp>
  35. <nomEsp>especialidad 2</nomEsp>
  36. </Esp>
  37. </EspeProf>
  38. <CMProf>
  39. <CM>
  40. <nomCM>centro medico</nomCM>
  41. </CM>
  42. </CMProf>
  43. </Prof>
  44. </root>
  45.  
  46. data = []
  47. try:
  48.  
  49. if hasattr(ssl, '_create_unverified_context'):
  50. ssl._create_default_https_context = ssl._create_unverified_context
  51. url = '******'
  52.  
  53. xml = urlopen(url)
  54. xml_string = xml.read()
  55. xml.close()
  56. xmldoc = minidom.parseString(xml_string)
  57. nombre=xmldoc.getElementsByTagName('nom')
  58. especialidad=xmldoc.getElementsByTagName('nomEsp').childNodes[0]
  59. for nom, esp in zip(nombre, especialidad):
  60. nombremedico=nom.firstChild.nodeValue
  61. especialidadmedico=esp.firstChild.data
  62. print(nombremedico)
  63. print(especialidadmedico)
  64. data.append({"name":nombremedico,"info":especialidadmedico})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement