forked from cwjokaka/ok_ip_proxy_pool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy_entity.py
More file actions
55 lines (52 loc) · 1.9 KB
/
proxy_entity.py
File metadata and controls
55 lines (52 loc) · 1.9 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from src.enum.common import ProxyTypeEnum, ProxyCoverEnum
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
Base = declarative_base()
class ProxyEntity(Base):
__tablename__ = 'proxy'
url = Column(String(36), primary_key=True)
# ip = Column(String(20))
# port = Column(String(5))
source = Column(String(16))
# protocol = Column(String(5))
supplier = Column(String(16))
proxy_type = Column(Integer())
proxy_cover = Column(Integer())
check_count = Column(Integer())
region = Column(String(32))
last_check_time = Column(String(32))
reliability = Column(Integer())
"""
ip代理对象
:param url url地址
:param ip ip地址
:param port 端口
:param protocol 协议
:param source 代理源头网站名
:param proxy_type 代理类型 {@link ProxyType}
:param proxy_cover 代理隐蔽性 {@link CoverOfProxy}
:param check_count 有效性检验的次数
:param last_check_time 最后进行有效性检验的时间
:param reliability 代理可靠性, 默认为5
"""
def __init__(self, url: str,
# ip: str,
# port: str,
# protocol: str = 'http',
source: str = 'unknown',
supplier='unknown',
proxy_type: int = ProxyTypeEnum.UNKNOWN.value,
proxy_cover: int = ProxyCoverEnum.UNKNOWN.value,
check_count=0, region='', last_check_time=None, reliability=5):
self.url = url
# self.ip = ip
# self.port = port
# self.protocol = protocol
self.source = source
self.supplier = supplier
self.proxy_type = proxy_type
self.proxy_cover = proxy_cover
self.check_count = check_count
self.region = region
self.last_check_time = last_check_time
self.reliability = reliability