GithubHelp home page GithubHelp logo

roeeyn / graphql-python-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from luxorlabs/graphql-python-client

0.0 0.0 0.0 40 KB

Luxor Python Library and Command Line GraphQL API Client

Python 99.74% Shell 0.26%

graphql-python-client's Introduction

Luxor Python Library and Command Line GraphQL API Client

API Documentation

This Library / Client implements a subset of available endpoints. API Docs can be found here.

Get Started

To get started, you will need the following basic information:

  • Endpoint: https://api.beta.luxor.tech/graphql
  • Organization Slug: luxor
  • API Key: Generated through Luxor UI

Additionally, remember to install the needed dependencies for the script with:

# We suggest using a python 3.10 and a virtual environment
pip install -r requirements3.txt

Library Usage

Luxor is divided in two parts, the first one containing the GraphQL API requests and the second adds resolvers for the API output.

Code Snippet

from luxor import API
from resolvers import RESOLVERS

API = API(host = 'https://api.beta.luxor.tech/graphql', method = 'POST', org = 'luxor', key = 'lxk514e9be027b9a132b1aa39bab818a12e')
RESOLVERS = RESOLVERS(df = False)

resp = API.method(parameters)
resolved = RESOLVERS.method(resp)

Command Line Usage

To get started and get params help run:

python luxor.py -h

Result:

$ python3 luxor.py --help

 Usage: luxor.py [OPTIONS] COMMAND [ARGS]...

╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.                                                                                                   │
│ --show-completion             Show completion for the current shell, to copy it or customize the installation.                                                            │
│ --help                        Show this message and exit.                                                                                                                 │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ get-all-transaction-history        Get all the transaction history of the user associated to the token provided.                                                          │
│ get-hashrate-score-history         Returns a subaccount earnings, scoring hashrate and efficiency per day.                                                                │
│ get-pool-hashrate                  Returns an integer count of distinct Profile active workers.                                                                           │
│ get-profile-active-worker-count    Returns an integer count of distinct Profile active workers. Workers are classified as active if we recorded a share in the last 15    │
│                                    minutes.                                                                                                                               │
│ get-profile-inactive-worker-count  Returns an integer count of distinct Profile inactive workers. Workers are classified as inactive if we have not recorded a share in   │
│                                    the last 15 minutes.                                                                                                                   │
│ get-revenue                        Returns on-chain transactions for a subaccount and currency combo.                                                                     │
│ get-revenue-ph                     Returns average Hashprice per PH over the last 24H.                                                                                    │
│ get-subaccount-hashrate-history    Returns an object of a subaccount hashrate timeseries.                                                                                 │
│ get-subaccount-mining-summary      Returns an object of a subaccount mining summary.                                                                                      │
│ get-subaccount-workers-status      Returns an integer count of distinct Profile active workers.                                                                           │
│ get-subaccounts                    Returns all subaccounts that belong to the Profile owner of the API Key.                                                               │
│ get-transaction-history            Returns on-chain transactions for a subaccount and currency combo.                                                                     │
│ get-worker-details                 Returns object of all workers pointed to a subaccount hashrate and efficiency details with a user-defined interval.                    │
│ get-worker-details-1h              Returns object of all workers pointed to a subaccount hashrate and efficiency details in the last hour.                                │
│ get-worker-details-24h             Returns object of all workers pointed to a subaccount hashrate and efficiency details in the last 24 hours.                            │
│ get-worker-hashrate-history        Returns an object of a miner hashrate timeseries.                                                                                      │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Example usage:

python3 luxor.py -k KEY -f get_transaction_history -p username,BTC,10

Developing

We use pre-commit to maintain the same code standards. To use it just run:

pre-commit install

Now it will run the needed validations with each commit.

Happy Hashing!

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.