aboutsummaryrefslogtreecommitdiff
path: root/tools/test-map.py
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-03-07 22:59:12 -0600
committerIván Ávalos <avalos@disroot.org>2024-03-07 22:59:12 -0600
commit00d3ddf7b5e335a5112a28a547c4c9ec2c3bd1d2 (patch)
treea02ecb75a8533194314d32c0c667520bff5e919d /tools/test-map.py
parent8e1bc703227a875c20e453704d774ce5772f2621 (diff)
parent75b404db5c790bf37c05fabf1cbbd2027ad1db25 (diff)
downloadtrackermap-server-00d3ddf7b5e335a5112a28a547c4c9ec2c3bd1d2.tar.gz
trackermap-server-00d3ddf7b5e335a5112a28a547c4c9ec2c3bd1d2.tar.bz2
trackermap-server-00d3ddf7b5e335a5112a28a547c4c9ec2c3bd1d2.zip
Merge branch 'master' of https://github.com/traccar/traccar
Diffstat (limited to 'tools/test-map.py')
-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