I have some code that is returning the error: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 14 of the file scrape7.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor.
My code is:
import numbers
import httplib2
import requests
import re
from bs4 import BeautifulSoup, SoupStrainer
http = httplib2.Http()
status, response = http.request('https://www.macys.com/social/the-edit/')
editurlslist = []
for link in BeautifulSoup(response, parse_only=SoupStrainer('a')):
if link.has_attr('href'):
if '/the-edit' in link['href']:
editurlslist.append(str("https://www.macys.com"+link['href']))
products = []
for i in editurlslist:
products.append(re.findall(r'(data-thisProduct=\"[0-9]{7}\")',
requests.get(i).text))
for i in editurlslist:
products.append(re.findall(r'(productid=\"[0-9]{7}\")',
requests.get(i).text))
products2 = [x for x in products if type(x) in numberic_types]
print(products2)