unitaryfund / metriq-client

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

Metriq API client

This is a client for Metriq read/write API.

It is adapted from the PapersWithCode client, with thanks!

The API is completely covered by the client and it wraps all the API models into python objects and communicates with the API by getting and passing those objects from and to the API client.

Quick usage example

You will require the pipenv package on your machine in order to instantiate a virtual environment. This can be done with pip install --user pipenv.

You will then need to install and activate the virtual environment:

pipenv install
pipenv shell

Once the virtual environment has been activated, to check that the metriq-client API is working as expected, run the following example script from metriq-client/examples/metriq_hello.py:

You will need to create an environment variable METRIQ_CLIENT_API_KEY to store the Metriq API key. On Linux/Unix operating systems, you can run

export METRIQ_CLIENT_API_KEY=<the key you get from the website>

in your terminal. On Windows, you can similarly add this variable as an environment variable. Once you have created the environment variable, you can verify that the client works as follows:

from metriq import MetriqClient
import os

client = MetriqClient(token=str(os.environ["METRIQ_CLIENT_API_KEY"]))
print(client.hello())
>>> {'status': 'API is working', 'message': 'This is the Metriq public REST API.'}

Further usage

Submissions

Many details of submissions can be managed using the client. For example, the following functionalities can be invoked:

Platforms

Information on platforms can also be accessed and edited:

Tags

Similarly, with the client, it is possible to get tag information from Metriq. This includes being able to get a list of tag items with tag_get, or a list of their names with tag_get_names.

Tasks

The client can also:

Methods

Functions exist for accessing information about methods:

For even more examples of usage, consult metriq-client/examples.