Answer the question
In order to leave comments, you need to log in
Parsing in python does not work, what should I do?
Hello. The task is to write a parser for this site . I wrote a script, but it does not give the result, but gives out the main page, please help.
import requests
from bs4 import BeautifulSoup
number = input('Введите номер: ')
URL = 'https://phonebook.space/?input=%2B' + number
HEADERS = {'user_agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:86.0) Gecko/20100101 Firefox/86.0', 'accept': '*/*'}
def getHtml(url, params=None):
r = requests.get(url, headers = HEADERS)
return r
def parse():
html = getHtml(URL)
print(html.status_code)
print(html.text)
parse()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question