Giter VIP home page Giter VIP logo

metriq-client's Introduction

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:

  • Adding a submission or any part of one (method, tag, task, etc.) with submission_add and related functions.
  • Deleting a submission with submission_delete.
  • Sorting submissions (by latest, popular, or trending) with submission_get_by_*.
  • Upvoting a submission with submission_upvote.
  • Updating a submission with submission_update.

Platforms

Information on platforms can also be accessed and edited:

  • Platforms can be added with platform_add and updated with platform_update.
  • A list of platforms can be invoked using platform_get.
  • A list of platforms sorted by how many submissions each has using platform_get_submission_count.

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:

  • Add tasks with task_add.
  • Update tasks with task_update.
  • Get information on tasks with task_get and task_get_*.

Methods

Functions exist for accessing information about methods:

  • Adding a method to Metriq with method_add.
  • Returning infomration about methods with method_get and method_get_*.
  • Updating a method with method_update.

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

metriq-client's People

Contributors

quantumali avatar vprusso avatar wrathfulspatula avatar srilakshmip03 avatar rstojnic avatar alefnula avatar mariam0003 avatar wingcode avatar karenrezkalla2 avatar avdiv avatar karlaspuldaro avatar willzeng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.