(src)
| 150 | # An object/dictionary is first converted to json string then it's converted to bytes. |
| 151 | # A string is directly converted to bytes. |
| 152 | def encode_to_bytes(src): |
| 153 | if src == None: |
| 154 | return None |
| 155 | if isinstance(src, str): |
| 156 | return ('"' + src + '"').encode() |
| 157 | return json.dumps(src).encode('utf-8') |
| 158 | |
| 159 | |
| 160 | # Parse credentials |