import requests import xml.etree.ElementTree as ET class Bing: def __init__(self): self.url = 'https://www.bing.com/search' ''' def search_hosts(self, hosts): for host in hosts: parse(search(host['ip'])) def search(self, ip,): r = requests.get(self.url, params={'q': 'ip:' + ip, 'format': 'rss', 'first': first}); tree = ET.fromstring(r.content) return tree def parse(self, tree): count = 0 for i in tree[0]: if i.tag == 'item': count += 1 print(i[1].text) if count == 10: return 1 else: return 0 '''