Skip to content

get_application_token -- TypeError: a bytes-like object is required, not 'str' #8

@zack-doll

Description

@zack-doll

Trying to get an application token and am getting
Traceback (most recent call last): File "query.py", line 150, in <module> main() File "query.py", line 142, in main app_token = oauth.get_application_token(env_type = environment.PRODUCTION, scopes = constant.SCOPE) File "/mnt/c/Users/Zack/Documents/src/CardMonitor/ebay_oauth_python_client/oauthclient/oauth2api.py", line 75, in get_application_token headers = model.util._generate_request_headers(credential) File "/mnt/c/Users/Zack/Documents/src/CardMonitor/ebay_oauth_python_client/oauthclient/model/util.py", line 23, in _generate_request_headers b64_encoded_credential = base64.b64encode(credential.client_id + ':' + credential.client_secret) File "/usr/lib/python3.8/base64.py", line 58, in b64encode encoded = binascii.b2a_base64(s, newline=False) TypeError: a bytes-like object is required, not 'str'

There don't appear to be any issues loading credentials. My config file is an exact copy of the provided sample, with my keys replaced of course.

And this is what my script looks like thus far:
def main():\ print("Hello World!") print("loading credential...") credentialutil.load('config.json') print("...loaded?") oauth = oauth2api() app_token = oauth.get_application_token(env_type = environment.PRODUCTION, scopes = constant.SCOPE) print(app_token)

Thanks for any help! This is my first time using OAuth and also my first GitHub issue... Cheers

P.S. My apologies, I'm unsure how to include linebreaks here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions