mirror of
https://github.com/etienne-hd/lbc.git
synced 2026-04-19 13:32:40 +02:00
Changed: proxy handling, you can now remove proxy using client.proxy = None; client._session is now public -> client.session
Added: proxy examples at examples/proxy.py
This commit is contained in:
29
examples/proxy.py
Normal file
29
examples/proxy.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import lbc
|
||||
|
||||
def main() -> None:
|
||||
# Setup proxy1
|
||||
proxy1 = lbc.Proxy(
|
||||
host="127.0.0.1",
|
||||
port=12345,
|
||||
username="username",
|
||||
password="password",
|
||||
scheme="http"
|
||||
)
|
||||
|
||||
# Initialize client with proxy1
|
||||
client = lbc.Client(proxy=proxy1)
|
||||
|
||||
# Setup proxy2
|
||||
proxy2 = lbc.Proxy(
|
||||
host="127.0.0.1",
|
||||
port=23456,
|
||||
)
|
||||
|
||||
# Change client proxy to proxy2
|
||||
client.proxy = proxy2
|
||||
|
||||
# Remove proxy
|
||||
client.proxy = None
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user