Override the send method to strip the request_payload's brackets since Vortex does not.
(self, data_to_send)
| 40 | self.retry = 0 |
| 41 | |
| 42 | def send(self, data_to_send): |
| 43 | """ |
| 44 | Override the send method to strip the request_payload's brackets since Vortex does not. |
| 45 | """ |
| 46 | request_payload = json.dumps([a.write() for a in data_to_send]).strip('[').strip(']') |
| 47 | |
| 48 | request = HTTPClient.Request(self._service_endpoint_uri, |
| 49 | bytearray(request_payload, 'utf-8'), |
| 50 | {'Accept': 'application/json', |
| 51 | 'Content-Type': 'application/json; charset=utf-8'}) |
| 52 | try: |
| 53 | response = HTTPClient.urlopen(request, timeout=self._timeout) |
| 54 | status_code = response.getcode() |
| 55 | if 200 <= status_code < 300: |
| 56 | if in_diagnostic_mode(): |
| 57 | print('Telemetry uploaded succesfully.') |
| 58 | return |
| 59 | except HTTPError as e: |
| 60 | if e.getcode() == 400: |
| 61 | raise e |
| 62 | except (AttributeError, ValueError, URLError): |
| 63 | if self.retry < 3: |
| 64 | self.retry += 1 |
| 65 | else: |
| 66 | return |
| 67 | |
| 68 | # Add our unsent data back on to the queue |
| 69 | for data in data_to_send: |
| 70 | self._queue.put(data) |
| 71 | |
| 72 | |
| 73 | class VortexTelemetryChannel(TelemetryChannel): |
nothing calls this directly
no test coverage detected