Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read credentials from the config file #213

Open
hhashim1 opened this issue Sep 17, 2021 · 2 comments
Open

Cannot read credentials from the config file #213

hhashim1 opened this issue Sep 17, 2021 · 2 comments

Comments

@hhashim1
Copy link

I keep getting the following error when I try to run any of the pages. The config file is there in the right folder. If I take the values from the config file then I am able to move forwards but unable to read the credentials from the config file. Any thoughts?

Message=No section: 'main'
Source=E:\Dropbox\Documents\Visual Studio 2019\Projects\td-ameritrade-python-api\tests\unit\test_stream.py
StackTrace:
File "E:\Dropbox\Documents\Visual Studio 2019\Projects\td-ameritrade-python-api\tests\unit\test_stream.py", line 21, in setUp (Current frame)
CLIENT_ID = config.get('main', 'CLIENT_ID')
File "E:\Dropbox\Documents\Visual Studio 2019\Projects\td-ameritrade-python-api\tests\unit\test_stream.py", line 155, in
unittest.main()

Here is the section of the code:

    # Grab configuration values.
    config = ConfigParser()
    config.read('config2/config.ini')

    CLIENT_ID = config.get('main', 'CLIENT_ID')
    REDIRECT_URI = config.get('main', 'REDIRECT_URI')
    JSON_PATH = config.get('main', 'JSON_PATH')
    ACCOUNT_NUMBER = config.get('main', 'ACCOUNT_NUMBER')
@regholl
Copy link

regholl commented Mar 12, 2022

i'm getting that same error,was it ever solved?

@LukeDickerson19
Copy link

LukeDickerson19 commented May 26, 2022

Whats you're config2/config.ini file look like? Mine is:

[main]
client_id = '<consumer_key>'
redirect_uri = 'http://localhost'

The readme example script was able to read the file for me, maybe you're missing the [main] part? FWI i manually created this file, idk if we're supposed to. I'm running into a diff error later in the readme example script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants