Hadi GhahremanNezhad
Hadi GhahremanNezhad

Reputation: 2455

Errors when trying to search yahoo

I am trying to search a query in yahoo using this code:

import re
import requests

query = "deep"
yahoo = "https://search.yahoo.com/search?q=" + query
raw_page = requests.get(yahoo) 

But I get an error like this:

TypeError: init() got an unexpected keyword argument 'strict'

The error happens at the last line. How can I fix this?

Edit

This is the whole code:

import re
import requests

no = 10
query = "deep"
yahoo = "https://search.yahoo.com/search?q=" + query + "&n=" + str(no)
#yahoo = "https://search.yahoo.com/search?p=" + query
raw_page = requests.get(yahoo) 
results = re.findall(r'(?<=<h3 class="r"><a href="/url\?q=).*?(?=&amp)', str(raw_page))
res = list(set(results))[0:30] #Provides 30 unique of the 35 we requested above

print(res)

and this is the error track:

enter image description here

Upvotes: 0

Views: 71

Answers (1)

dsfbmmg
dsfbmmg

Reputation: 926

According to this random github issue, you may want to update your requests library to the latest version ie. # pip install requests -U

Upvotes: 2

Related Questions