Skip to content

Commit

Permalink
Drop unneccessary binascii import (#2909)
Browse files Browse the repository at this point in the history
* Drop unneccessary binascii import

* Update httpx/_multipart.py

Co-authored-by: T-256 <[email protected]>

* boundary is 'bytes' not 'str'

---------

Co-authored-by: T-256 <[email protected]>
  • Loading branch information
tomchristie and T-256 authored Oct 30, 2023
1 parent 31a7bb3 commit 9751f76
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions httpx/_multipart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import binascii
import io
import os
import typing
Expand Down Expand Up @@ -200,7 +199,7 @@ def __init__(
boundary: typing.Optional[bytes] = None,
) -> None:
if boundary is None:
boundary = binascii.hexlify(os.urandom(16))
boundary = os.urandom(16).hex().encode("ascii")

self.boundary = boundary
self.content_type = "multipart/form-data; boundary=%s" % boundary.decode(
Expand Down

0 comments on commit 9751f76

Please sign in to comment.