diff options
author | Anton Tananaev <anton@traccar.org> | 2022-11-27 16:19:49 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-11-27 16:19:49 -0800 |
commit | 6142cf557dc130828c12dbfb25ab18eda4bc0f7d (patch) | |
tree | a8d3b981796f2e5dc68be9e401afa5d6297abbbb | |
parent | 938872ff5e2fad867720ec9c971ea432ba623c2c (diff) | |
download | trackermap-server-6142cf557dc130828c12dbfb25ab18eda4bc0f7d.tar.gz trackermap-server-6142cf557dc130828c12dbfb25ab18eda4bc0f7d.tar.bz2 trackermap-server-6142cf557dc130828c12dbfb25ab18eda4bc0f7d.zip |
Update python scripts
-rwxr-xr-x | tools/test-generator.py | 4 | ||||
-rwxr-xr-x | tools/test-integration.py | 4 | ||||
-rwxr-xr-x | tools/test-map.py | 6 | ||||
-rwxr-xr-x | tools/test-trips.py | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/tools/test-generator.py b/tools/test-generator.py index 6e30c7fea..ed135b4aa 100755 --- a/tools/test-generator.py +++ b/tools/test-generator.py @@ -3,7 +3,7 @@ import sys import math import urllib -import httplib +import http.client as httplib import time import random @@ -51,7 +51,7 @@ def send(conn, lat, lon, altitude, course, speed, battery, alarm, ignition, accu params = params + (('fuel', fuel),) if driverUniqueId: params = params + (('driverUniqueId', driverUniqueId),) - conn.request('GET', '?' + urllib.urlencode(params)) + conn.request('GET', '?' + urllib.parse.urlencode(params)) conn.getresponse().read() def course(lat1, lon1, lat2, lon2): diff --git a/tools/test-integration.py b/tools/test-integration.py index f926a8ae9..89f1c76ed 100755 --- a/tools/test-integration.py +++ b/tools/test-integration.py @@ -140,7 +140,7 @@ def load_ports(): def login(): request = urllib2.Request(baseUrl + '/api/session') - response = urllib2.urlopen(request, urllib.urlencode(user)) + response = urllib2.urlopen(request, urllib.parse.urlencode(user)) if debug: print '\nlogin: %s\n' % repr(json.load(response)) return response.headers.get('Set-Cookie') @@ -176,7 +176,7 @@ def send_message(port, message): def get_protocols(cookie, device_id): params = { 'deviceId' : device_id, 'from' : '2000-01-01T00:00:00.000Z', 'to' : '2050-01-01T00:00:00.000Z' } - request = urllib2.Request(baseUrl + '/api/positions?' + urllib.urlencode(params)) + request = urllib2.Request(baseUrl + '/api/positions?' + urllib.parse.urlencode(params)) request.add_header('Cookie', cookie) request.add_header('Content-Type', 'application/json') request.add_header('Accept', 'application/json') diff --git a/tools/test-map.py b/tools/test-map.py index 5808c1fbb..362c95878 100755 --- a/tools/test-map.py +++ b/tools/test-map.py @@ -2,7 +2,7 @@ import urllib import urllib2 -import httplib +import http.client as httplib import time import random import json @@ -14,7 +14,7 @@ devices = 500 def login(): request = urllib2.Request(baseUrl + '/api/session') - response = urllib2.urlopen(request, urllib.urlencode(user)) + response = urllib2.urlopen(request, urllib.parse.urlencode(user)) return response.headers.get('Set-Cookie') def add_device(cookie, unique_id): @@ -29,7 +29,7 @@ def add_device(cookie, unique_id): def send_message(conn, device_id): params = (('id', device_id), ('lat', random.uniform(59, 61)), ('lon', random.uniform(29, 31))) - conn.request('GET', '?' + urllib.urlencode(params)) + conn.request('GET', '?' + urllib.parse.urlencode(params)) conn.getresponse().read() cookie = login() diff --git a/tools/test-trips.py b/tools/test-trips.py index 267752fbb..3c994fd83 100755 --- a/tools/test-trips.py +++ b/tools/test-trips.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import urllib -import httplib +import http.client as httplib import time import datetime @@ -25,7 +25,7 @@ points = [ def send(conn, time, lat, lon, speed): params = (('id', id), ('timestamp', int(time)), ('lat', lat), ('lon', lon), ('speed', speed)) - conn.request('POST', '?' + urllib.urlencode(params)) + conn.request('POST', '?' + urllib.parse.urlencode(params)) conn.getresponse().read() conn = httplib.HTTPConnection(server) |