Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
Created December 6, 2015 15:40
Show Gist options
  • Save kissgyorgy/90d05051df1c3cd320b6 to your computer and use it in GitHub Desktop.
Save kissgyorgy/90d05051df1c3cd320b6 to your computer and use it in GitHub Desktop.
Random pizza picker from website
# -*- 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