Proxylist Package¶
The proxylist package provides function and classes for:
loading list of proxy servers from different sources like local file or network location
rotating proxy servers or picking them randomly
Feel free to give feedback in Telegram groups: @grablab and @grablab_ru.
Usage Example¶
>>> from proxylist import ProxyList
>>> pl = ProxyList.from_local_file('var/proxy.txt')
>>> pl.get_random_server()
<proxylist.server.ProxyServer object at 0x7f1882d599e8>
>>> pl.get_random_server().address()
'1.1.1.1:8085'
>>> len(pl)
1000
Installation¶
Run: pip install -U proxylist
Documentation¶
Documentation is available at http://proxylist.readthedocs.org
API Reference¶
This page contains auto-generated API reference documentation 1.
proxylist
¶
Submodules¶
proxylist.base
¶
- class proxylist.base.BaseProxySource[source]¶
- abstract get_servers_list() list[proxylist.server.ProxyServer] [source]¶
proxylist.errors
¶
- exception proxylist.errors.ProxyListError[source]¶
Bases:
Exception
Common base class for all non-exit exceptions.
- exception proxylist.errors.InvalidProxyLine[source]¶
Bases:
ProxyListError
Common base class for all non-exit exceptions.
- exception proxylist.errors.ProxySourceReadError[source]¶
Bases:
ProxyListError
Common base class for all non-exit exceptions.
proxylist.parser
¶
|
Parse proxy details from the text line. |
Iterate proxy servers found in the content of text file. |
- proxylist.parser.parse_proxy_line(line: str) tuple[str, int, None | str, None | str] [source]¶
Parse proxy details from the text line.
The text line could be in one of the following formats: * host:port * host:port:username:password
- proxylist.parser.parse_servers_from_text(data: str, proxy_type: None | str, proxy_auth: None | tuple[str, str] = None) collections.abc.Iterator[proxylist.server.ProxyServer] [source]¶
Iterate proxy servers found in the content of text file.
proxylist.proxylist
¶
Class to work with proxy list. |
- class proxylist.proxylist.ProxyList(source: proxylist.source.BaseProxySource)[source]¶
Class to work with proxy list.
- classmethod from_local_file(path: str, **kwargs: Any) ProxyList [source]¶
Create proxy list from file.
- classmethod from_network_file(url: str, **kwargs: Any) ProxyList [source]¶
Create proxy list from network document.
- classmethod from_lines_list(items: collections.abc.Sequence[str], **kwargs: Any) ProxyList [source]¶
Create proxy list from list of strings.
- get_random_server() proxylist.server.ProxyServer [source]¶
Return random server.
- get_next_server() proxylist.server.ProxyServer [source]¶
Return next server.
- __iter__() collections.abc.Iterator[proxylist.server.ProxyServer] [source]¶
- __getitem__(key: int) proxylist.server.ProxyServer [source]¶
proxylist.server
¶
proxylist.source
¶
- class proxylist.source.BaseProxySource[source]¶
- abstract get_servers_list() list[proxylist.server.ProxyServer] [source]¶
Package Contents¶
Classes¶
Class to work with proxy list. |
|
Load list from python list of strings. |
|
Load list from the file. |
|
Load list from web resource. |
- class proxylist.ProxyList(source: proxylist.source.BaseProxySource)[source]¶
Class to work with proxy list.
- classmethod from_local_file(path: str, **kwargs: Any) ProxyList [source]¶
Create proxy list from file.
- classmethod from_network_file(url: str, **kwargs: Any) ProxyList [source]¶
Create proxy list from network document.
- classmethod from_lines_list(items: collections.abc.Sequence[str], **kwargs: Any) ProxyList [source]¶
Create proxy list from list of strings.
- get_random_server() proxylist.server.ProxyServer [source]¶
Return random server.
- get_next_server() proxylist.server.ProxyServer [source]¶
Return next server.
- __iter__() collections.abc.Iterator[proxylist.server.ProxyServer] [source]¶
- __getitem__(key: int) proxylist.server.ProxyServer [source]¶
- class proxylist.ProxyServer[source]¶
Bases:
NamedTuple
- host :str¶
- port :int¶
- username :None | str¶
- password :None | str¶
- proxy_type :None | str¶
- class proxylist.LinesListProxySource(lines: collections.abc.Sequence[str], **kwargs: Any)[source]¶
Bases:
BaseFileProxySource
Load list from python list of strings.
- 1
Created with sphinx-autoapi