AI-multimodal / aimm-post-processing

This repository is depricated. We will be doing all postprocessing in `aimmdb.postprocessing`.
Other
0 stars 3 forks source link

Key Error when loading url #5

Closed zleung9 closed 2 years ago

zleung9 commented 2 years ago

when executing client.py, it raises the following exception from line 117. @jmaruland Do you know what possibly causes this? Or a key is needed to access the database?

Exception has occurred: KeyError
'type'
  File "[/Users/zhuliang/Documents/XAS.nosync/aimm-post-processing/aimm_post_processing/client.py]()", line 117, in <module>
client = from_uri("[https://aimm.lbl.gov/api]()")

https://github.com/AI-multimodal/aimm-post-processing/blob/6a07f97279aa8e2fc24988e5ad3889eb5ab18db0/aimm_post_processing/client.py#L117

matthewcarbone commented 2 years ago

@zhul9311 Yeah the issue is that right now Juan probably setup his own local API key which is read from an environment variable or something. I've gotten some instructions from Joe on how to do this. Once I do, I will post some instructions. For now you need to make the client "interactive" in e.g. a Jupyter notebook.

from tiled.client import from_uri
c = from_uri("https://aimm.lbl.gov/api")
c

The above will prompt you for the ORCID login.

matthewcarbone commented 2 years ago

@zhul9311 Ok I've done it. The instructions are really clear: follow this doc, and set the environment variable. Then you never have to enter your API key when using from_uri.

https://blueskyproject.io/tiled/how-to/api-keys.html

I use oh-my-zsh, but depending on the terminal you're using (let's assume it's terminal that comes with Mac) you'll want to make sure something like this is set so the environment variable is automatically initialized every time you start up the terminal:

# ~/.bashrc
# or in my case, ~/.zshrc
source ~/.bash_profile
# ~/.bash_profile
export TILED_API_KEY=YOUR_KEY_HERE

Let me know if you have any questions! I'll also add these docs to the README at some point. Feel free to re-open the issue if this doesn't solve the problem.