-
Notifications
You must be signed in to change notification settings - Fork 10
Functions (Threads)
CheshireCaat edited this page Mar 9, 2020
·
6 revisions
Running functions through threads is very similar to a regular launch through BasRemoteClient
. The main feature of this type of launch is that you can control the launch yourself, stop the thread, and check whether it is busy with the execution of functions. This is very convenient cause it gives you complete control over the execution of functions.
If you want to create new thread then use client.create_thread()
method. This method returns an instance of the BasThread
class, that contains several useful methods and properties. Take a look at example.
thread = client.create_thread()
# Set up proxy.
await thread.run_function('SetProxy', {
'Proxy': '127.0.0.1:11185',
'IsSocks5': 'true',
}).result()
# Check the ip of this proxy.
proxy_ip = await thread.run_function('CheckIp').result()
# Stop the thread.
await thread.stop()