@@ -1,6 +1,5 | |||||
1 | from django.db import models |
|
1 | from django.db import models | |
2 | from apps.main.models import Configuration |
|
2 | from apps.main.models import Configuration | |
3 | #from json_field import JSONField |
|
|||
4 | from django.core.validators import MinValueValidator, MaxValueValidator |
|
3 | from django.core.validators import MinValueValidator, MaxValueValidator | |
5 |
|
4 | |||
6 |
|
5 | |||
@@ -72,7 +71,7 class CGSConfiguration(Configuration): | |||||
72 |
|
71 | |||
73 | route = "http://" + str(ip) + ":" + str(port) + "/status/ad9548" |
|
72 | route = "http://" + str(ip) + ":" + str(port) + "/status/ad9548" | |
74 | try: |
|
73 | try: | |
75 | r = requests.get(route) |
|
74 | r = requests.get(route,timeout=1) | |
76 | except: |
|
75 | except: | |
77 | self.device.status = 0 |
|
76 | self.device.status = 0 | |
78 | self.device.save() |
|
77 | self.device.save() | |
@@ -111,7 +110,7 class CGSConfiguration(Configuration): | |||||
111 |
|
110 | |||
112 | route = "http://" + str(ip) + ":" + str(port) + "/frequencies/" |
|
111 | route = "http://" + str(ip) + ":" + str(port) + "/frequencies/" | |
113 | try: |
|
112 | try: | |
114 | frequencies = requests.get(route) |
|
113 | frequencies = requests.get(route,timeout=1) | |
115 |
|
114 | |||
116 | except: |
|
115 | except: | |
117 | self.message = "Could not read CGS parameters from this device" |
|
116 | self.message = "Could not read CGS parameters from this device" | |
@@ -149,7 +148,7 class CGSConfiguration(Configuration): | |||||
149 | route = "http://" + str(ip) + ":" + str(port) + "/frequencies/" |
|
148 | route = "http://" + str(ip) + ":" + str(port) + "/frequencies/" | |
150 |
|
149 | |||
151 | try: |
|
150 | try: | |
152 | r = requests.post(route, post_data) |
|
151 | r = requests.post(route, post_data, timeout=1) | |
153 | except: |
|
152 | except: | |
154 | self.message = "Could not write CGS parameters" |
|
153 | self.message = "Could not write CGS parameters" | |
155 | return None |
|
154 | return None |
General Comments 0
You need to be logged in to leave comments.
Login now