-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskAPI.py
More file actions
39 lines (27 loc) · 738 Bytes
/
TaskAPI.py
File metadata and controls
39 lines (27 loc) · 738 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
27
28
29
30
31
32
33
34
35
36
37
38
39
import pandas as pd
import requests
df = pd.read_csv('list_ip.csv')
cutoff_list = []
ip_list = []
for y in range (0,200):
ip = df.iloc[y]
url = ('https://ipqualityscore.com/api/json/ip')
params = {
'key': 'YOUR_API_KEY',
'ip': ip,
'strictness': 2,
'allow_public_access_points': 'true',
'mobil': 'false',
'fast': 'false',
'lighter_penalties': 'false'
}
response = requests.get(url, params)
data = response.json()
cutoff_list.append(data)
ip_list.append(ip)
my_df = pd.DataFrame(cutoff_list)
my_df_ip = pd.DataFrame(ip_list)
extracted_col = my_df_ip['ip']
my_df = my_df.join(extracted_col)
my_df.to_csv('list.csv', index=False)
print(my_df)