Skip to content

Commit

Permalink
Update exchange.py
Browse files Browse the repository at this point in the history
Moving comment block
  • Loading branch information
brianddk authored Apr 2, 2024
1 parent b52d941 commit 4c89a1e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyexch/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,14 @@ def run_server(port, handler):


def data_toDict(data):
# bugbug: This should never happen, but the cloudflare (or whoever) server sometimes returns
# Requests.Response.content as <type 'str'> and other times as <type 'bytes'>. This breaks
# Requests.Response.json() since it expects 'bytes'
# https://github.com/psf/requests/blob/d63e94f/src/requests/models.py#L942
if type(data) is dict:
return data
if type(data) is Response:
if type(data.content) is str:
# bugbug: This should never happen, but the cloudflare (or whoever) server sometimes returns
# Requests.Response.content as <type 'str'> and other times as <type 'bytes'>. This breaks
# Requests.Response.json() since it expects 'bytes'
# https://github.com/psf/requests/blob/d63e94f/src/requests/models.py#L942
data = data.content
else:
try:
Expand Down

0 comments on commit 4c89a1e

Please sign in to comment.