mirror of
https://github.com/traccar/traccar.git
synced 2025-01-07 03:07:01 +08:00
Fix map testing script
This commit is contained in:
parent
3082f7b3e5
commit
7c67b6f9b4
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user