NDAR / nda_aws_token_generator

Repository with sample code and libraries for obtaining AWS credentials to use with your NIMH Data Archives account
MIT License
9 stars 11 forks source link

Install the NDA token generator library? #8

Open cmlaubacher opened 4 years ago

cmlaubacher commented 4 years ago

Hello,

I was able to get this program working successfully a few months ago on a different Mac, and now I cannot find documentation to install the library token generator. I tried installing nda-tools, but that did not create a library token generator as far as I can tell.

devjason commented 4 years ago

If you are just trying to just run the bash command line version I think you should be able to run the shell script after download with this invocation:

cd nda_aws_token_generator/curl
bash generate_token.sh 'username' 'password' 'https://nda.nih.gov/DataManager/dataManager'

If you are wanting to use the Python version, you should be able to use either package. For this package the easiest approach is probably to install it using the setup.py program.

Python Option 1: Install this package using distutils

# After downloading the nda_aws_token_generator package
cd nda_aws_token_generator/python/
sudo python setup.py install

This will make the package available in your default python libraries.

Python Option 2: Use nda-tools

Since you've already downloaded and installed nda-tools, you can also use the token generator packaged within it.

  1. Install nda-tools, e.g. pip install nda-tools
  2. Use the token generator directly in your script via from NDATools.TokenGenerator import NDATokenGenerator and instantiating it with the DataManager URL.

Let us know if you are still having problems.

cmlaubacher commented 4 years ago

Hi Jason,

I have tried to install nda-tools, but I do not think token generator package attached correctly? Is there any way to install the token generator separately?


From: Jason Smith notifications@github.com Sent: Monday, March 2, 2020 3:44 PM To: NDAR/nda_aws_token_generator nda_aws_token_generator@noreply.github.com Cc: CLAIRE MORGAN LAUBACHER laubacher@wisc.edu; Author author@noreply.github.com Subject: Re: [NDAR/nda_aws_token_generator] Install the NDA token generator library? (#8)

If you are just trying to just run the bash command line version I think you should be able to run the shell script after download with this invocation:

cd nda_aws_token_generator/curl bash generate_token.sh 'username' 'password' 'https://nda.nih.gov/DataManager/dataManager'

If you are wanting to use the Python version, you should be able to use either package. For this package the easiest approach is probably to install it using the setup.py program.

Python Option 1: Install this package using distutils

After downloading the nda_aws_token_generator package

cd nda_aws_token_generator/python/ sudo python setup.py install

This will make the package available in your default python libraries.

Python Option 2: Use nda-tools

Since you've already downloaded and installed nda-tools, you can also use the token generator packaged within it.

  1. Install nda-tools, e.g. pip install nda-tools
  2. Use the token generator directly in your script via from NDATools.TokenGenerator import NDATokenGenerator and instantiating it with the DataManager URL.

Let us know if you are still having problems.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/NDAR/nda_aws_token_generator/issues/8?email_source=notifications&email_token=AOLAAYE4SXFJ7SKPHYHA2ZLRFQSFVA5CNFSM4KXNPPSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENRDNFY#issuecomment-593639063, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOLAAYGWN5YLWJDN7NAMT53RFQSFVANCNFSM4KXNPPSA.

obenshaindw commented 4 years ago

@cmlaubacher did you try Option 1 from Jason's earlier message?

This would make the package available to your scripts locally. If you did try that method, what was the outcome? Can you share the python version you are trying to use with it, the steps you are following to install it, and then how you are calling the library within your code?

Thanks

cmlaubacher commented 4 years ago
Screen Shot 2020-03-23 at 11 16 48 AM

I got a warning message when I tried to install nda-tools with python2.7 so I installed with python 3 instead. The resulting directory structure did not include a path to nda_aws_token_generator/python/

When I tried to use option 2, and tried running 'from NDATools.TokenGenerator import NDATokenGenerator' I got an error message "can't read /var/mail/NDATools.TokenGenerator"