unitaryfund / metriq-client

Fork of papers-with-code client
https://metriq.info
Apache License 2.0
3 stars 9 forks source link

Examples: Update API token definition #79

Closed vprusso closed 1 year ago

vprusso commented 1 year ago

At present, there is a hard-coded API token in each of the files in the examples/ directory. We should expect that the user supplies this token instead of providing one explicitly in the examples. That is, whenever we instantiate a MetriqClient object in the examples, we should put a placeholder string. Something like the following:

MetriqClient(token="<*Metriq API key*>")

Alternatively, and perhaps preferably, it may be good to include a mechanism by which the user sets their Metriq API token within their environment variables. That is, we should explain in the README that we expect the user to define an environment variable in their system .env file defined as

METRIQ_CLIENT_API_KEY = "<Metriq API Key>"

and then we could simply do

import os

MetriqClient(token=os.environ["METRIQ_CLIENT_API_KEY"])
vprusso commented 1 year ago

Closed in https://github.com/unitaryfund/metriq-client/pull/90