Skip to content

Instantly share code, notes, and snippets.

@beaumartinez
Last active December 16, 2015 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beaumartinez/5501700 to your computer and use it in GitHub Desktop.
Save beaumartinez/5501700 to your computer and use it in GitHub Desktop.
from lxml.html import fromstring
from requests import get
def get_soups():
'''Get today's soups at Pret.
Return a list in the format:
['Sausage Hot Pot', 'Lentil & Coconut Curry', 'Cream of Mushroom']
'''
response = get('http://www.pret.co.uk/todays_soups.htm')
page = fromstring(response.text)
soups = page.cssselect('div.panel a img')
soups = map(lambda soup: soup.attrib['alt'], soups)
return soups
if __name__ == '__main__':
print get_soups()
@mattcanty
Copy link

Is this for real?

@beaumartinez
Copy link
Author

THIS IS FOR REAL (how did I not see this comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment