Skip to content

Commit

Permalink
Fetch provider links from optimade.org
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Jan 10, 2020
1 parent 04d6a86 commit 4ca961c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion optimade/server/data/test_links.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"name": "Index meta-database",
"description": "Index for example's OPTiMaDe databases",
"base_url": "http://localhost:5001/index/optimade",
"homepage": "https://example.org"
"homepage": "https://example.com"
}
]
2 changes: 1 addition & 1 deletion optimade/server/index_links.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"name": "OPTiMaDe API",
"description": "The [Open Databases Integration for Materials Design (OPTiMaDe) consortium](http://http://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.",
"base_url": "http://localhost:5000/optimade",
"homepage": "https://example.org"
"homepage": "https://example.com"
}
]
4 changes: 1 addition & 3 deletions optimade/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def load_entries(endpoint_name: str, endpoint_collection: MongoCollection):
bson.json_util.loads(bson.json_util.dumps(data))
)
if endpoint_name == "links":
print(
"adding providers.json to links from github.com/Materials-Consortia/OPTiMaDe"
)
print("adding Materials-Consortia providers to links from optimade.org")
endpoint_collection.collection.insert_many(
bson.json_util.loads(bson.json_util.dumps(get_providers()))
)
Expand Down
4 changes: 2 additions & 2 deletions optimade/server/routers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ def retrieve_queryable_properties(schema: dict, queryable_properties: list) -> d


def get_providers():
"""Retrieve providers.json from /Materials-Consortia/OPTiMaDe"""
"""Retrieve Materials-Consortia providers (from https://www.optimade.org/providers/links)"""
import requests
from bson.objectid import ObjectId

mat_consortia_providers = requests.get(
"https://raw.githubusercontent.com/Materials-Consortia/OPTiMaDe/master/providers.json"
"https://www.optimade.org/providers/links"
).json()

providers_list = []
Expand Down

0 comments on commit 4ca961c

Please sign in to comment.