Skip to content

Instantly share code, notes, and snippets.

@jayapal
Created April 8, 2017 11:21
Show Gist options
  • Save jayapal/195b4fc0f9842d812917ec3287d1bfe8 to your computer and use it in GitHub Desktop.
Save jayapal/195b4fc0f9842d812917ec3287d1bfe8 to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
def get_image_url(purchase_url):
"""
Method to get HTML content from Lowes store and return product image
@params purchase_url : product url
@outpout : img url
"""
html = requests.get(purchase_url).text
soup = BeautifulSoup(html)
img_el = soup.find('img',{'class':'product-image pd-epc'})
if img_el:
return img_el['src']
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment