-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_2
More file actions
26 lines (21 loc) · 877 Bytes
/
code_2
File metadata and controls
26 lines (21 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import requests
import lxml
from bs4 import BeautifulSoup
from requests.api import head
import csv
from datetime import datetime
# создаем словарь с заголовками запроса
headers = {
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
}
def get_data(url):
response = requests.get(url=url, headers=headers)
# print(response)
# Записываем информацию в html файл
with open(file='index3.html', mode='w', encoding='UTF-8') as file:
file.write(response.text)
def main():
get_data(url='https://fleetphoto.ru/entities/?rid=1')
if __name__ == '__main__':
main()