Fix a few remaining cases in session.py where .encode() was being called for bytes.