scylla package

Submodules

scylla.cli module

scylla.cli.app_main()[源代码]
scylla.cli.handle_special_flags(args: dict)[源代码]
scylla.cli.main(args) → int[源代码]

scylla.config module

scylla.config.batch_set_config(**kwargs)[源代码]
scylla.config.get_config(key: str, default: str = None) → Union[str, NoneType][源代码]
scylla.config.set_config(key: str, value: str)[源代码]

scylla.database module

class scylla.database.BaseModel(*args, **kwargs)[源代码]

基类:peewee.Model

DoesNotExist

BaseModelDoesNotExist 的别名

id = <peewee.AutoField object>
class scylla.database.ProxyIP(*args, **kwargs)[源代码]

基类:scylla.database.BaseModel

DoesNotExist

ProxyIPDoesNotExist 的别名

city = <peewee.CharField object>
country = <peewee.CharField object>
created_at = <peewee.DateTimeField object>
id = <peewee.AutoField object>
ip = <peewee.CharField object>
is_anonymous = <peewee.BooleanField object>
is_valid = <peewee.BooleanField object>
latency = <peewee.FloatField object>
location = <peewee.CharField object>
organization = <peewee.CharField object>
port = <peewee.IntegerField object>
region = <peewee.CharField object>
stability = <peewee.FloatField object>
updated_at = <peewee.DateTimeField object>
scylla.database.create_connection() → peewee.SqliteDatabase[源代码]

create a database connection :rtype: SqliteDatabase

scylla.database.create_db_tables()[源代码]

scylla.jobs module

scylla.jobs.save_ip(p: scylla.database.ProxyIP)[源代码]
scylla.jobs.validate_proxy_ip(p: scylla.database.ProxyIP)[源代码]

scylla.loggings module

scylla.scheduler module

class scylla.scheduler.Scheduler[源代码]

基类:object

feed_providers()[源代码]
join()[源代码]

Wait for worker processes and validator threads

start()[源代码]

Start the scheduler with processes for worker (fetching candidate proxies from different providers), and validator threads for checking whether the fetched proxies are able to use.

stop()[源代码]
scylla.scheduler.cron_schedule(scheduler, only_once=False)[源代码]
参数:
  • scheduler -- the Scheduler instance
  • only_once -- flag for testing
scylla.scheduler.fetch_ips(q: <bound method BaseContext.Queue of <multiprocessing.context.DefaultContext object at 0x7f32ad9fc898>>, validator_queue: <bound method BaseContext.Queue of <multiprocessing.context.DefaultContext object at 0x7f32ad9fc898>>)[源代码]
scylla.scheduler.validate_ips(q: <bound method BaseContext.Queue of <multiprocessing.context.DefaultContext object at 0x7f32ad9fc898>>, validator_pool: concurrent.futures.thread.ThreadPoolExecutor)[源代码]

scylla.tcpping module

class scylla.tcpping.Ping(host: str, port: int, timeout=1)[源代码]

基类:object

get_average() → float[源代码]
get_maximum() → float[源代码]
get_minimum() → float[源代码]
get_success_rate()[源代码]
ping(count=10, sleep=0.3)[源代码]
class scylla.tcpping.Socket(family, type_, timeout)[源代码]

基类:object

close()[源代码]
connect(host, port=80)[源代码]
shutdown()[源代码]
class scylla.tcpping.Timer[源代码]

基类:object

cost(funcs, args)[源代码]
start()[源代码]
stop()[源代码]
scylla.tcpping.avg(x)[源代码]
scylla.tcpping.ping(host: str, port: int, count: int = 10, sleep: float = 0.2) -> (<class 'int'>, <class 'float'>)[源代码]

Ping a server and port with tcp socket :param host: the hostname :param port: the port number :param count: number of connection tries, by default it is 10 :param sleep: length of sleep time in between sequent pings, by default it is 0.3 :return: a tuple for (average_latency, success_rate)

scylla.validator module

class scylla.validator.Validator(host: str, port: int, using_ssl: bool = False)[源代码]

基类:object

anonymous
latency
meta
success_rate
valid
validate()[源代码]
validate_latency()[源代码]
validate_proxy()[源代码]
scylla.validator.get_current_ip()[源代码]

scylla.worker module

class scylla.worker.Worker[源代码]

基类:object

get_html(url: str, render_js: bool = True) → Union[requests_html.HTML, NoneType][源代码]

Get html from a specific URL

参数:
  • url -- the URL
  • render_js -- [whether to render js], defaults to True
  • render_js -- bool, optional
返回:

[the HTML string]

返回类型:

str

Module contents