Skip to content

Instantly share code, notes, and snippets.

@aalipar13
Created September 17, 2018 08:42
Show Gist options
  • Save aalipar13/86a310ce31ed42724f3aa0a0addc0ab9 to your computer and use it in GitHub Desktop.
Save aalipar13/86a310ce31ed42724f3aa0a0addc0ab9 to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
headers = requests.utils.default_headers()
headers.update({
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0',
})
url = 'https://www.costco.com/'
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.content)
f = soup.find('div', attrs={'data-bi-placement': 'Home_Hero_Carousel'})
print(f.contents)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment