Replace numbers with question marks in signal name
This commit is contained in:
parent
575b6a240f
commit
aa8ee887d3
|
@ -1,4 +1,5 @@
|
||||||
import re
|
import re
|
||||||
|
from string import digits
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
|
@ -98,6 +99,9 @@ class HookAPI(APIView):
|
||||||
# 'Stoch Exit'
|
# 'Stoch Exit'
|
||||||
|
|
||||||
signal_name = " ".join(hook_resp.message.split(":")[0].split(" ")[2:])
|
signal_name = " ".join(hook_resp.message.split(":")[0].split(" ")[2:])
|
||||||
|
for x in signal_name:
|
||||||
|
if x in digits:
|
||||||
|
signal_name = signal_name.replace(x, "?")
|
||||||
try:
|
try:
|
||||||
signal = Signal.objects.get(signal=signal_name)
|
signal = Signal.objects.get(signal=signal_name)
|
||||||
except Signal.DoesNotExist:
|
except Signal.DoesNotExist:
|
||||||
|
|
Loading…
Reference in New Issue