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

Bit of straightening out about the environment variables. #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rkiddy
Copy link

@rkiddy rkiddy commented Jun 23, 2015

Trying to make this a bit more clear for someone first using it.

It would also be easier if there was a way to set the ivar values via the command line or in a resource file. As it is now, I get:

$ python ./trello/util.py
Traceback (most recent call last):
File "./trello/util.py", line 91, in
create_oauth_token()
File "./trello/util.py", line 24, in create_oauth_token
trello_key = key or os.environ['TRELLO_API_KEY']
File "/usr/lib/python2.7/UserDict.py", line 23, in getitem
raise KeyError(key)
KeyError: 'TRELLO_API_KEY'
$
$ echo $TRELLO_API_KEY
2b6790f8042489d77227f3a632ae0add
$

So, the environment variable is set, but not in the right way?

FYI, I am on an Ubuntu 14.04 system.

Also, your TrelloClient requires a:

  • api_key='your-key'
  • api_secret='your-secret'
  • token='your-oauth-token-key'
  • token_secret='your-oauth-token-secret'

I can see what the first three are. What is a token_secret? I get the OAuth token and ... that is it.

@sarumont
Copy link
Owner

I'm not sure why it is not picking up your TRELLO_API_KEY. I have no issues using this:

$ uname -a
Darwin masamune 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

$ python --version
Python 2.7.9

$ echo $TRELLO_API_KEY
foo

$ python ./trello/util.py
Traceback (most recent call last):
  File "./trello/util.py", line 91, in <module>
    create_oauth_token()
  File "./trello/util.py", line 33, in create_oauth_token
    response = session.fetch_request_token(request_token_url)
  File "/usr/local/lib/python2.7/site-packages/requests_oauthlib/oauth1_session.py", line 261, in fetch_request_token
    token = self._fetch_token(url)
  File "/usr/local/lib/python2.7/site-packages/requests_oauthlib/oauth1_session.py", line 344, in _fetch_token
    raise TokenRequestDenied(error % (r.status_code, r.text), r.status_code)
requests_oauthlib.oauth1_session.TokenRequestDenied: Token request failed with code 500, response was 'App not found'.

Last I tried, it was working on Ubuntu, as well.

As to the token_secret, that is due to the fact that py-trello is utilizing OAuth 1.0 to authenticate to Trello. In 1.0, tokens are used in pairs (typically token and token_secret - see this).

@sarumont sarumont self-assigned this Jul 21, 2015
@HomiGrotas
Copy link

Hi @rkiddy !
You get token_secret after you use python -m trello oauth to get your Trello OAuth token.
About your environment variables issue - I suggest you to check again how you configured your environment variables, as it seems there isn't a problem at instructions nor the code itself. Tested using python2.7 and python3.10 and worked fine.
You also can here the full way (from configuring env. vars to the error) in order to help us examine the issue.
Thanks

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

Successfully merging this pull request may close these issues.

3 participants