Skip to content

Commit

Permalink
Merge pull request #48 from materials-data-facility/forge-dev
Browse files Browse the repository at this point in the history
Support Toolbox native-login
  • Loading branch information
jgaff authored Oct 23, 2019
2 parents c5431b2 + 18103fc commit 3824d0f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ before_install:
- openssl aes-256-cbc -K $encrypted_39a50b90a369_key -iv $encrypted_39a50b90a369_iv
-in travis.tar.enc -out travis.tar -d
- tar xvf travis.tar
- mkdir -p ~/.mdf/credentials/
- mv MDF_Forge_tokens.json ~/.mdf/credentials/MDF_Forge_tokens.json
- mv .globus-native-apps.cfg ~/.globus-native-apps.cfg
after_success:
- coveralls
notifications:
Expand Down
13 changes: 8 additions & 5 deletions mdf_forge/forge.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Forge(mdf_toolbox.AggregateHelper, mdf_toolbox.SearchHelper):
__auth_services = ["data_mdf", "transfer", "search", "petrel"]
__anon_services = ["search"]
__app_name = "MDF_Forge"
__client_id = "b2b437c4-17c1-4e4b-8f15-e9783e1312d7"
__transfer_interval = 60 # 1 minute, in seconds
__inactivity_time = 1 * 60 * 60 # 1 hour, in seconds

Expand Down Expand Up @@ -78,11 +79,13 @@ def __init__(self, index=__default_index, local_ep=None, anonymous=False,
clients = (mdf_toolbox.anonymous_login(services) if services else {})
else:
services = kwargs.get('services', self.__auth_services)
clients = (mdf_toolbox.login(
credentials={
"app_name": self.__app_name,
"services": services},
clear_old_tokens=clear_old_tokens) if services else {})
if services:
clients = mdf_toolbox.login(services=services, app_name=self.__app_name,
client_id=self.__client_id,
clear_old_tokens=clear_old_tokens)
else:
clients = {}

search_client = kwargs.pop("search_client", clients.get("search", None))
self.__transfer_client = kwargs.get("transfer_client", clients.get("transfer", None))
self.__data_mdf_authorizer = kwargs.get("data_mdf_authorizer",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

setup(
name='mdf_forge',
version='0.7.4',
version='0.7.5',
packages=['mdf_forge'],
description='Materials Data Facility python package',
long_description=("Forge is the Materials Data Facility Python package"
" to interface and leverage the MDF Data Discovery service. "
"Forge allows users to perform simple queries and "
"facilitiates moving and synthesizing results."),
install_requires=[
"mdf-toolbox>=0.4.10",
"mdf-toolbox>=0.5.0",
"globus-sdk>=1.7.0",
"requests>=2.18.4",
"tqdm>=4.19.4"
Expand Down
Binary file modified travis.tar.enc
Binary file not shown.

0 comments on commit 3824d0f

Please sign in to comment.