Last active
January 31, 2023 19:07
-
-
Save felipebastosweb/850becd3b25cfa251bb003446f7a4731 to your computer and use it in GitHub Desktop.
Detect signals
This file contains hidden or 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
import time | |
import json | |
import requests | |
colors = ('w', 'r', 'b') | |
last_results = '' | |
pattern_list = [ | |
'rrr', | |
'bbb', | |
'rbrb', | |
'brbr', | |
'bwr', | |
'rwb' | |
] | |
before_result = '' | |
while True: | |
resultado = (requests.get("https://api-v2.blaze.com/api/roulette_games/current")).json() | |
print(resultado['status'] + '\n') | |
if resultado['status'] == 'rolling': | |
# verifica sorted | |
sorted = colors[resultado['color']] +';'+ str(resultado['roll']) +';'+ resultado['created_at'] #+';'+ resultado['updated_at'] | |
if before_result == sorted: | |
time.sleep(2) | |
continue | |
else: | |
before_result = sorted | |
if len(last_results) > 5: | |
last_results = last_results[1:] | |
last_results += colors[resultado['color']] | |
# last results | |
for pattern in pattern_list: | |
if pattern in last_results: | |
print(pattern) | |
print(''.join(sorted + '\n')) | |
else: | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment