Skip to content

Commit 58cb22e

Browse files
authored
Merge pull request #13 from Windham-High-School/9-accept-code-updates
Fixed header concatenation bug
2 parents 99d0cff + b499978 commit 58cb22e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

servercom/implementations/circuitpy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ def _do_request(
269269
f"{method} {path} HTTP/1.1\r\n" +
270270
"Host: api.local\r\n" +
271271
"Connection: close\r\n" +
272-
f"Authorization: Basic {auth_str}\r\n" +
273-
'\r\n'.join(headers)
272+
f"Authorization: Basic {auth_str}" +
273+
'\r\n'.join(headers) + "\r\n"
274274
)
275275
del auth_str
276276
collect()
@@ -382,7 +382,7 @@ def get_status(self) -> GameStatus:
382382
if self.v:
383383
print("Getting status...")
384384
resp = self.request('GET', '/status',
385-
headers=['User-Agent: CircuitPython, dude!']
385+
headers=['User-Agent: CircuitPythonDude']
386386
)
387387
resp_json = loads(resp[1])
388388
if self.v:
@@ -397,7 +397,7 @@ def post(self, point: DataPoint) -> bool:
397397
'/data',
398398
point.dumps(),
399399
content_type = 'application/json',
400-
headers=['User-Agent: CircuitPython, dude!']
400+
headers=['User-Agent: CircuitPythonDude']
401401
).code == 201
402402

403403
def email(self, msg: Email) -> bool:
@@ -408,7 +408,7 @@ def email(self, msg: Email) -> bool:
408408
'/email',
409409
msg.dumps(),
410410
content_type = 'application/json',
411-
headers=['User-Agent: CircuitPython, dude!']
411+
headers=['User-Agent: CircuitPythonDude']
412412
).code == 201
413413

414414
def code_update(self, reset=True) -> bool:
@@ -425,7 +425,7 @@ def code_update(self, reset=True) -> bool:
425425
response = self.request(
426426
'GET',
427427
'/update',
428-
headers=['User-Agent: CircuitPython, dude!']
428+
headers=['User-Agent: CircuitPythonDude']
429429
)
430430
if response.code != 200:
431431
if self.v:

0 commit comments

Comments
 (0)