Advertisement
AntonioVillanueva

VBN TEST

May 20th, 2019
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # coding: utf-8
  3. """
  4. https://2.python-requests.org/en/master/
  5. """
  6. from html.parser import HTMLParser
  7. from html.entities import name2codepoint
  8. import requests
  9.  
  10.        
  11. #*******************************************************************************
  12. #                      HTML PARSER VISOR VAUBAN
  13. #*******************************************************************************
  14.  
  15. class MyHTMLParser(HTMLParser):
  16.  
  17.     def handle_starttag(self, tag, attrs):
  18.         if (tag!= "table" and tag!="newdataset"):
  19.             print (tag.upper()," = ",end='')
  20.  
  21.     def handle_endtag(self, tag):
  22.         if (tag=="table" or tag=="newdataset"):
  23.             #print ("*"*80, end ='')
  24.             print ("*********", end ='')            
  25.  
  26.     def handle_data(self, data):
  27.         print (data, end ='')
  28.        
  29.        
  30. #*******************************************************************************
  31. #                            MAIN   LOOP
  32. #*******************************************************************************
  33.  
  34. visor="http://192.168.6.117:8080/Visor/GetEventList&NumberOfEvents=10&StartDate=2019-05-17%2008:00:00&EndDate=2019-05-18%2020:00:00"
  35. page = requests.get(visor)  
  36. recup = page.text
  37.  
  38. #print (recup) #html
  39.  
  40. parser = MyHTMLParser()
  41. parser.feed (recup)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement