Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New sdk witch comply to new sdk-API (temporaly solution) #246

Closed
wants to merge 15 commits into from

Conversation

astroseger
Copy link
Collaborator

Temporally version of SDK which comply to new API (see singnet/snet-sdk-python#16).
This version will be replaced by more clean version by @vforvalerio87 which will add one level of abstraction between SDK and "Commands". But API will not change so you can use this SDK as it is..

This PR adds:

  • new SDK which comply to new API
  • CI for this SDK
  • SDK supports json encoding
  • Two funding strategy (Basic and Automatic)
  • Two ways of getting request_class (see example and discussion in SDK API discussion snet-sdk-python#16)

Simple example

from snet_cli.sdk import Session, Client, AutoFundingFundingStrategy
from snet_cli.config import Config

# we directly use snet-cli configuration
# another types of configuration can be easiliy implemented (for example hard-coded configuration)
session = Session(Config())

# In case of multiply grpc_service names you should specify the name of grpc_service
# Here we have only one grpc_service (Calculator), so we can omit this parameter
client = Client(session, "snet", "example-service", AutoFundingFundingStrategy(amount_cogs = 4, expiration = "+10days"))
for i in range(10):
    request = client.classes.Numbers(a=20, b=i)
    rez = client.stub.add(request)
    print("add", rez)
    request = client.get_request_class("mul")(a=20, b=i)
    rez = client.stub.mul(request)
    print("mul", rez)

@vsbogd
Copy link
Member

vsbogd commented Apr 11, 2019

Sergey, could you please rebase your branch on latest master

astroseger and others added 3 commits April 12, 2019 11:55
Rename doesn't work if src and destination are on different filesystems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants