Skip to content

Commit 5a2934e

Browse files
committed
use os.urandom()
1 parent a8b78ad commit 5a2934e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

adafruit_requests.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
import errno
4343
import json as json_module
44-
import random
44+
import os
4545
import sys
4646

4747
from adafruit_connection_manager import get_connection_manager
@@ -418,11 +418,7 @@ def _build_boundary_data(self, files: dict): # pylint: disable=too-many-locals
418418

419419
@staticmethod
420420
def _build_boundary_string():
421-
hex_characters = "0123456789abcdef"
422-
_boundary = ""
423-
for _ in range(32):
424-
_boundary += random.choice(hex_characters)
425-
return _boundary
421+
return os.urandom(16).hex()
426422

427423
@staticmethod
428424
def _check_headers(headers: Dict[str, str]):

0 commit comments

Comments
 (0)