initial commit
This commit is contained in:
commit
0007acad90
13 changed files with 1893 additions and 0 deletions
31
tests/linode-test.py
Normal file
31
tests/linode-test.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python3
|
||||
from squid_dl.linode import LinodeProxy
|
||||
from squid_dl.util import die, eprint
|
||||
from time import sleep
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
A simple LinodeProxy class example. This should work once you have setup
|
||||
linode-cli. Only tested with Linode CLI settings that select Arch Linux
|
||||
image by default. YMMV with other distro images.
|
||||
"""
|
||||
proxy = LinodeProxy(debug=True)
|
||||
while proxy.get_status() != "running":
|
||||
sleep(1)
|
||||
|
||||
if not proxy.start(headless=False):
|
||||
proxy.cleanup()
|
||||
print(proxy.proxy_proc.stdout.read().decode())
|
||||
eprint(proxy.proxy_proc.stderr.read().decode())
|
||||
die("BAD PROXY!")
|
||||
|
||||
sleep(10)
|
||||
# proxy.cleanup()
|
||||
proxy.proxy_proc.terminate()
|
||||
print(proxy.proxy_proc.stdout.read().decode())
|
||||
eprint(proxy.proxy_proc.stderr.read().decode())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue