Numba try except with beautifulsoup

Hello Everyone!
Just new in Numba I was trying to speed up my code. I trying to scrap data from approx 100000 web pages. But I am having the error below (after the code).
Thanks in advance!

############Code################
@jit
def foo():
out_df = pd.DataFrame()
try:
for link in all_links:
data = {‘Rating’:[],‘Review_title’:[],‘Reviews’:[]}
response = requests.get(link)
#soup = BeautifulSoup(response.text)
rows = BeautifulSoup(response.text).findAll(‘div’,class_=‘star-rating star-rating–medium’)
#Extract the the ratings
for row in rows:
img = row.find(‘img’)
data[‘Rating’].append(img[‘alt’])
soup_title = BeautifulSoup(response.text).findAll(‘a’,class_=‘link link–large link–dark’)
#Extract the the review titles
for rt in range(0,len(soup_title)):
data[‘Review_title’].append(soup_title[rt].get_text())
#Extract the the reviews
reviews = BeautifulSoup(response.text).findAll(‘p’,class_=‘review-content__text’)
for rev in range(0,len(reviews)):
data[‘Reviews’].append(reviews[rev].get_text().lstrip(’\n’))
out_df = pd.concat([out_df, pd.DataFrame(data)], axis=0)
except:
pass
return out_df

#######Errores#####################
:1: NumbaWarning:
Compilation is falling back to object mode WITH looplifting enabled because Function “foo” failed type inference due to: Untyped global name ‘BeautifulSoup’: cannot determine Numba type of <class ‘type’>

File “”, line 9:
def foo():

#soup = BeautifulSoup(response.text)
rows = BeautifulSoup(response.text).findAll(‘div’,class_=‘star-rating star-rating–medium’)
^

@jit
/Users/aladjidiallo/opt/anaconda3/lib/python3.8/site-packages/numba/core/object_mode_passes.py:177: NumbaWarning: Function “foo” was compiled in object mode without forceobj=True.

File “”, line 2:
@jit
def foo():
^

warnings.warn(errors.NumbaWarning(warn_msg,
/Users/aladjidiallo/opt/anaconda3/lib/python3.8/site-packages/numba/core/object_mode_passes.py:187: NumbaDeprecationWarning:
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.

For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit

File “”, line 2:
@jit
def foo():
^

warnings.warn(errors.NumbaDeprecationWarning(msg,

NameError Traceback (most recent call last)
in
----> 1 data = foo()

NameError: global name ‘mark_try_block’ is not defined

Hi @Aladji, although Numba is aware of many data types (dicts, arrays, tuples, etc.), the BeautifulSoup object is not one of them. You may be able to debug the code, but it is unlikely to be worth the effort. See https://numba.readthedocs.io/en/stable/glossary.html#term-object-mode for why. For more details on Numba use cases a good place to start is https://numba.pydata.org/numba-doc/dev/user/5minguide.html#will-numba-work-for-my-code.

BR,
Ryan