Created
December 6, 2015 15:40
-
-
Save kissgyorgy/90d05051df1c3cd320b6 to your computer and use it in GitHub Desktop.
Random pizza picker from website
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import random | |
from lxml import etree | |
import requests | |
def main(url): | |
response = requests.get(url) | |
root = etree.HTML(response.content) | |
pizzas = root.xpath('//h3') | |
print random.choice(pizzas).text | |
if __name__ == '__main__': | |
main('http://pizzaforte.hu/pizzak.php') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment