GithubHelp home page GithubHelp logo

ducoapi's Introduction

Official DUCO module for Python 3

To build your own Duino-Coin apps we've created Duino-Coin API for Python 3.

Created by Connorhess, maintained by Alicia426

Getting Started

from ducoapi import api_actions

Initialize the connection to the server

api_connection = api_actions() #creates the api connection instance

The next step is to Login/Register Note: login and register do not require you to init but they close the connection after use

Login

api_connection.login(username="username", password="password")

Register

api_connection.register(username="username", password="password", email="[email protected]")

Functions

These functions require user being loged-in.

Balance

Gets the current balance of the logged-in user
api_connection.balance() # takes no args

Transfer

Transfers Duco from logged-in user to the specified username
api_connection.transfer(recipient_username='test_user1', amount=1)

reset password

Resets the password of the logged-in user
api_connection.reset_pass(old_password='123', new_password='abc')

Get Latests Transactions

Get the latests transactions
api_connection.getTransactions(7) # 7 is the number of transactions to get
# returns JSON

Other Functions

Use of this functions does not require being loged-in.

Get Duco Price

returns the current Duco price as a float
>>> ducoapi.get_duco_price()
0.01249

Duco price update timer

starts a timer that updates the price at a specified interval in seconds (default is 15)
>>> ducoapi.start_duco_price_timer(interval = 5) # start the timer that updates the price every 5 seconds
>>> ducoapi.duco_price # you can get the updated price from a global variable <duco_price>
0.01249

Example API script

import ducoapi

api_connection = api_actions()

api_connection.login(username='YourUsername', password='YourPassword')

current_balance = api_connection.balance()
print(current_balance)

api_connection.close()

ducoapi's People

Contributors

connorhess avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ducoapi's Issues

socket.timeout

Hi! I was testing example from this repo and i got this
image

Now i am located in russia, and i was thinking that's geo block.
Then i tried VPN, and another one vpn, and another...

What's the problem?

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.