forked from jahidhasanshuvo/PythonScraper-Automobiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsvTest.py
More file actions
37 lines (27 loc) · 1.05 KB
/
Copy pathcsvTest.py
File metadata and controls
37 lines (27 loc) · 1.05 KB
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
27
28
29
30
31
32
33
34
35
36
37
import os
import csv
file = os.path.isfile('testcsv.csv')
print(file)
with open('testcsv.csv', 'a', newline='') as csvfile:
fieldnames = ['first_name', 'last_name']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames,delimiter=',')
if not file:
writer.writeheader()
writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})
writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})
writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})
from bs4 import BeautifulSoup
import requests
proxies = {
"https": "https://103.229.84.141:8080",
"http": "http://103.229.84.141:8080"
}
source = requests.get('https://www.rockauto.com',proxies=proxies)
print(source.text)
# domain = 'https://www.rockauto.com/en/catalog/abarth,1969,1000,982cc+l4,1438885,brake+&+wheel+hub'
# brand_source = requests.get(domain).text
# brand_soup = BeautifulSoup(brand_source,'lxml')
# brands = brand_soup.find_all('a',class_='navlabellink nvoffset nimportant')
# print(len(brands))
# for brand in brands:
# print(brand['href'])