Last active
January 25, 2018 11:30
-
-
Save MagnetonBora/3844761d296c01d250ca41bf84d5d109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from concurrent.futures import ThreadPoolExecutor | |
from requests_futures.sessions import FuturesSession | |
MAX_WORKERS = 4 | |
URL = "http://mdemo.webtm.ru/bot/test.php?notify_type=signal&callput=CALL&symbol=%A0&tfdigi=5&tfdur=m&logints=R2D2&passts=123123" | |
def fire_and_forget(url, executor=None): | |
session = FuturesSession(executor=executor) | |
return session.get(url) | |
def main(): | |
executor = ThreadPoolExecutor(max_workers=MAX_WORKERS) | |
while True: | |
future = fire_and_forget(URL, executor=executor) | |
print('Defered request: ', future) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment