encode is returning a bytes object but the annotation suggests that it returns a str. Trying to send the token over the network ends up ruining the token. The fix is easy - applying token.decode('utf-8'), but it can only be used if the developer knows that encode returns bytes.
encode is returning a bytes object but the annotation suggests that it returns a str. Trying to send the token over the network ends up ruining the token. The fix is easy - applying
token.decode('utf-8')
, but it can only be used if the developer knows that encode returnsbytes
.