Answer the question
In order to leave comments, you need to log in
What kind of cipher is issued during parsing?
Hello.
They get the CitiLink website page, write it to a file, run it through bs4. Gives nothing. I get into the file with the page code, and there is an incomprehensible cipher:
I also have another page of the site downloaded already, where everything is fine. However, a similar situation has already arisen, and only after a couple of repeated requests did I get a normal code.
What is it? Why is this happening, and how to get a normal page the first time?
If anything, here is the class responsible for writing and reading files:
class Html_pages:
def write(directory, file_name, url, html): # принимает директорию куда сохранять, имя файла, ссылку страницы, код
file = open('./Database/Pages/' + directory + '/' + file_name + '.txt', 'w', encoding='utf-8')
file.write(url + '\n')
file.write(str(html))
file.close()
def get(directory, file_name):
file = io.open('./Database/Pages/' + directory + '/' + file_name + '.txt', 'r', encoding='utf-8')
html = ''
for line in file:
html += line
file.close()
return html
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