aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-03-26 07:07:46 -0700
committerAnton Tananaev <anton@traccar.org>2023-03-26 07:07:46 -0700
commit7c67b6f9b46a350ae111eff2caea5981dc0e1bff (patch)
tree90c0ce6e86e349d9e5984fc382765d8c0af4aee4
parent3082f7b3e5bfd00ec6f6801222060dfc0d10b7e0 (diff)
downloadtrackermap-server-7c67b6f9b46a350ae111eff2caea5981dc0e1bff.tar.gz
trackermap-server-7c67b6f9b46a350ae111eff2caea5981dc0e1bff.tar.bz2
trackermap-server-7c67b6f9b46a350ae111eff2caea5981dc0e1bff.zip
Fix map testing script
-rwxr-xr-xtools/test-map.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/test-map.py b/tools/test-map.py
index 362c95878..664917eff 100755
--- a/tools/test-map.py
+++ b/tools/test-map.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
import urllib
-import urllib2
+import urllib.request as urllib2
import http.client as httplib
import time
import random
@@ -14,7 +14,7 @@ devices = 500
def login():
request = urllib2.Request(baseUrl + '/api/session')
- response = urllib2.urlopen(request, urllib.parse.urlencode(user))
+ response = urllib2.urlopen(request, urllib.parse.urlencode(user).encode())
return response.headers.get('Set-Cookie')
def add_device(cookie, unique_id):
@@ -23,7 +23,7 @@ def add_device(cookie, unique_id):
request.add_header('Content-Type', 'application/json')
device = { 'name' : unique_id, 'uniqueId' : unique_id }
try:
- response = urllib2.urlopen(request, json.dumps(device))
+ response = urllib2.urlopen(request, json.dumps(device).encode())
except urllib2.HTTPError:
pass