Don't send to sign if it's not configured
This commit is contained in:
parent
7b5dac7c6e
commit
4079896dc8
|
@ -575,12 +575,13 @@ class StatsViewSet(viewsets.ViewSet, List):
|
|||
sign = request.data['sign']
|
||||
cache.set('sign', sign)
|
||||
|
||||
try:
|
||||
post_data = dict(access_token=secrets.SIGN_TOKEN, args=sign)
|
||||
r = requests.post('https://api.particle.io/v1/devices/200042000647343232363230/text/', data=post_data, timeout=5)
|
||||
r.raise_for_status()
|
||||
except:
|
||||
raise exceptions.ValidationError(dict(sign='Something went wrong :('))
|
||||
if secrets.SIGN_TOKEN:
|
||||
try:
|
||||
post_data = dict(access_token=secrets.SIGN_TOKEN, args=sign)
|
||||
r = requests.post('https://api.particle.io/v1/devices/200042000647343232363230/text/', data=post_data, timeout=5)
|
||||
r.raise_for_status()
|
||||
except:
|
||||
raise exceptions.ValidationError(dict(sign='Something went wrong :('))
|
||||
|
||||
return Response(200)
|
||||
except KeyError:
|
||||
|
|
Loading…
Reference in New Issue
Block a user