-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathproxy.py
34 lines (24 loc) · 818 Bytes
/
proxy.py
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
#!/usr/bin/env python
# encoding: utf-8
import datetime
from peewee import *
from setting import CURRENT_DIR
proxypool_database = SqliteDatabase(CURRENT_DIR + '/proxypool.db')
class Proxy_IP(Model):
ip_and_port = CharField()
type = CharField(default="http")
round_trip_time = DoubleField(null=True)
country = CharField(null=True)
anonymity = CharField(null=True)
timestamp = DateTimeField(default=datetime.datetime.now)
def __str__(self):
return self.type + "://" + self.ip_and_port
def __hash__(self):
return hash(str(self))
def __eq__(self, other):
if isinstance(other, Proxy_IP):
return str(self) == str(other)
class Meta:
database = proxypool_database
if __name__ == "__main__":
print(CURRENT_DIR + '/proxypool.db')