TDG-Platform / gbdx-auth

Oauth2 python tool for using the GBDX APIs
4 stars 9 forks source link

Getting auth token when using .gbdx-config for GBDX creds fails #5

Closed jeffreyeriksondg closed 8 years ago

jeffreyeriksondg commented 8 years ago

I've set up my ~/.gbdx-config file as directed at http://gbdxtools.readthedocs.io/en/latest/user_guide.html using the client ID and secret located at https://gbdx.geobigdata.io/account/user/settings/#profile

When I attempt to execute the following code without having successfully connected before (i.e. without a [gbdx_token] entry already in my .gbdx-config file):

from gbdxtools import Interface
gbdx = Interface()

I get the following error:

Traceback (most recent call last):
  File "/home/jerikson/scratch/test-login.py", line 2, in <module>
    gbdx = Interface()
  File "/usr/local/lib/python2.7/dist-packages/gbdxtools/interface.py", line 36, in __init__
    self.gbdx_connection = gbdx_auth.get_session(kwargs.get('config_file'))
  File "/usr/local/lib/python2.7/dist-packages/gbdx_auth/gbdx_auth.py", line 144, in get_session
    raise Exception("Invalid credentials or incorrectly formated config file at ~/.gbdx-config")
Exception: Invalid credentials or incorrectly formated config file at ~/.gbdx-config
jeffreyeriksondg commented 8 years ago

I've created a pull request (https://github.com/TDG-Platform/gbdx-auth/pull/6) with the changes I had to make locally to get the above issue working.

jeffreyeriksondg commented 8 years ago

Output of pip freeze:

awscli==1.10.28
backports-abc==0.4
backports.shutil-get-terminal-size==1.0.0
backports.ssl-match-hostname==3.5.0.1
boto==2.39.0
boto3==1.4.0
botocore==1.4.19
cached-property==1.3.0
ccsm==0.9.12.2
certifi==2016.2.28
cffi==1.7.0
chardet==2.3.0
colorama==0.3.3
compizconfig-python==0.9.12.2
configparser==3.5.0
cryptography==1.4
cycler==0.9.0
decorator==4.0.9
docker-compose==1.7.1
docker-py==1.8.1
dockerpty==0.4.1
docopt==0.6.2
docutils==0.12
entrypoints==0.2.2
enum34==1.1.5
functools32==3.2.3.post2
future==0.15.2
futures==3.0.5
gbdx-auth==0.2.0
gbdxtools==0.5.2
GDAL==2.1.0
httplib2==0.9.1
idna==2.1
ipaddress==1.0.16
ipykernel==4.3.1
ipython==4.2.0
ipython-genutils==0.1.0
ipywidgets==5.1.5
Jinja2==2.8
jmespath==0.9.0
jsonschema==2.5.1
jupyter==1.0.0
jupyter-client==4.2.2
jupyter-console==4.1.1
jupyter-core==4.1.0
MarkupSafe==0.23
matplotlib==1.5.1
meld==3.14.2
mistune==0.7.2
mpmath==0.19
nbconvert==4.2.0
nbformat==4.0.1
ndg-httpsclient==0.4.2
notebook==4.2.0
numpy==1.11.0
oauthlib==1.1.2
pathlib2==2.1.0
pexpect==4.1.0
pickleshare==0.7.2
Pillow==3.1.2
pomodoro-indicator==0.1.0
psycopg2==2.6.1
ptyprocess==0.5.1
pyasn1==0.1.9
pycparser==2.14
pygeoif==0.6
Pygments==2.1
pygobject==3.20.0
pyOpenSSL==16.0.0
pyparsing==2.0.3
pyspatialite==3.0.1
python-dateutil==2.5.3
pytz==2014.10
PyYAML==3.11
pyzmq==15.2.0
qtconsole==4.2.1
requests==2.9.1
requests-oauthlib==0.6.1
rsa==3.3
s3transfer==0.1.1
Shapely==1.5.13
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
sympy==1.0
terminado==0.6
texttable==0.8.4
tornado==4.3
traitlets==4.2.1
unity-lens-photos==1.0
websocket-client==0.37.0
widgetsnbextension==1.2.3
jeffreyeriksondg commented 8 years ago

Turns out something must have changed between requests-oauthlib 0.6.1 (which my system was originally using) and 0.6.2 (which I've subsequently upgraded to). The upgrade appears to have fixed whatever was causing the problem.

hafez-ahmad commented 4 years ago

how to create create a GBDX credential file ? raise Exception("Please create a GBDX credential file at ~/.gbdx-config with these contents:\n%s" % error_output) Exception: Please create a GBDX credential file at ~/.gbdx-config with these contents: [gbdx] user_name = your_user_name user_password = your_password