create account

My Progress to Orca in Python (using JupyterLab) by forykw

View this thread on hive.blog
· @forykw · (edited)
$1.57
My Progress to Orca in Python (using JupyterLab)
# It has been a while!
Since my last post... I have been lacking the necessary time and disposition to share some interesting stuff. To add on that, life has not been easy lately, so, yep... I was just enjoying watching things around. Mostly playing #HIVEGames and watching the progress of the [HIVE dev activity](https://gitlab.syncad.com/groups/hive/-/activity).

<center>![](https://media1.tenor.com/images/7f2e8f29f3e97e3d06e69d49c22ad6bc/tenor.gif?itemid=10151868)</center>

![](https://images.ecency.com/DQmNtp2obvYABpQnhMXTne6Gj8wychVxj5SotJyKzouez1Q/image.png)


***Disclaimer:** this is a really basic example, but just felt like a good simple one on how to show everyone an easy way to play with the HIVE API.*

**Note:** This was driven from Windows (using JupyterLab from Anaconda) but you can do the same from any Linux machine. The idea was to show how that in the Windows platform you can do the same experiments.

# The main part of the code
This includes the `url` to the API node you are requesting the information. Change that to another one if that's your intention. Then, there is some encoding format of the message being sent, and finaly the API call documented [here](https://developers.hive.io/docs/apidefinitions/condenser-api.html#condenser_api.get_accounts). Lastly, you send the request, by post method.

```python
import requests
import json from requests.structures import CaseInsensitiveDict

#url = "https://rpc.esteem.app"
url = "https://api.hive.blog"

headers = CaseInsensitiveDict()
headers["Content-Type"] = "application/x-www-form-urlencoded"

# API request for the get_accounts function for the <user> in "params":[["<user>"]]
data = '{"jsonrpc":"2.0", "method":"condenser_api.get_accounts", "params":[["forykw"]], "id":1}'

# Sending the API request
resp = requests.post(url, headers=headers, data=data)
```

### This output is just to understand how the communication goes
```
# Print the status and reason of the request
print("Status Code:",resp.status_code,"Reason:",resp.reason)

# Print how long took for the request to be received
print("Request time:",resp.elapsed)
```
###  In this case all was good (quite fast response too)

    Status Code: 200 Reason: OK
    Request time: 0:00:01.054829
    
I usually get under the 1 second of response time. This one was one of the worst ones.


# If you need to see all the output you are getting
Uncomment this line and you will  get the entire response in JSON format.

```python
# If you need to see the detailed output of the request in JSON format, uncomment this
#json.loads(resp.text)
```

# Then the actual requests
I have added a couple more things just to exemplify how can you get other things form the JSON output.

```python
# Save the request output into a variable
json_data = json.loads(resp.text)

# Print the account HIVE Balance
print("HIVE Balance:",json_data['result'][0]['balance'])

# Print the account Voting Power in %
print("Voting Power:","{:.2%}".format(json_data['result'][0]['voting_power'] / 10000))

# Print the account progress in % to Orca status (100 Million VESTS)
print("Progress to Orca:","{:.12%}".format(float(json_data['result'][0]['vesting_shares'].split()[0]) / 100000000))
```

# The result ๐Ÿ™ƒ๐Ÿ˜Ž

    HIVE Balance: 41.460 HIVE
    Voting Power: 91.44%
    Progress to Orca: 63.878949907716%
    
---

# #HIVEGames
This hashtag is valid both on Hive and Twitter. So, if you have an account on either and you are up to post about dCity, make sure you use both #dCity and #HIVEGames. If you wish, also tag me on Twitter, the account I use there is mentioned bellow.

<div class="pull-right">
  <figure><a href="https://peakd.com/hive-148441/@forykw/2020-hive-blockchain-games-the-power-of-having-fun"><img src="https://images.hive.blog/0x0/https://files.peakd.com/file/peakd-hive/forykw/bQ2g7jrS-HIVE_2020_GAMES.png"/></a>
  <figcaption><center>(credit @doze)</center></figcaption></figure>
</div>

Supporting this initiative will be a tremendous help to the #HIVE ecosystem, especially if your area is into the #Blockchain #Games world. For more details of how this started, check the side image that links to the post.

Any questions, advice requests or comments are welcome, either here or anywhere else you find me.

# ๐Ÿ–๏ธHIVE5's!
Have fun, good luck on all the gaming and lots of teaching "how to play" to new players.

# Do you know about my new [Twitter account](https://twitter.com/forkyishere)?
If you have an account on Twitter (follow @forkyishere) and you enjoy #news about the #HIVE blockchain, make sure you tweet about any reference to your account here. I am following all HIVE users!

---
<center>
# Check these Cryptocurrency ๐Ÿ’ณCards
</center>
| [Crypto.com](https://platinum.crypto.com/r/hz3dzstewl) | [Crypterium](https://crypterium.app.link/UpvfysXUKY) | [TenX](https://webhooks.getonebit.com/api/wallet/share-link?source=edf4e92409a887b942968c6a4bd9180080935c2aa8490a7202caf65ecf6562c6) | Revolut | [Wirex](https://wirexapp.com/r/forykw) |
| --- | --- | --- | --- | --- |
| https://crypto.com/images/cards_sg/card-page-rose-gold-93d09a29.png | https://cards.crypterium.com/static/img/pics/card.png | https://images.ctfassets.net/xecblntwky6m/4DuzIWlnDW40Ksg2euYQaq/6fdfb10cc614e737c677fe01115f84fc/productCard.png | https://steemitimages.com/640x0/http://res.cloudinary.com/oracle-d/image/upload/v1541428832/fv1minzyjesg10zetx2q.png | https://img.wirexapp.com/images/t_optimize_transf/v1573412547/wirexapp/wirex30/en/en-img-card-hero.png/img |
<center>
# by @forykw ![](https://files.peakd.com/file/peakd-hive/forykw/MNu9mnm4-1MKqGoh8-forykw.gif)
</center>
๐Ÿ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 9 others
properties (23)
authorforykw
permlinkmy-progress-to-orca-in-python-using-jupyterlab
categoryhive-139531
json_metadata{"app":"ecency/3.0.7-vision","format":"markdown+html","image":["https://media1.tenor.com/images/7f2e8f29f3e97e3d06e69d49c22ad6bc/tenor.gif?itemid=10151868","https://images.ecency.com/DQmNtp2obvYABpQnhMXTne6Gj8wychVxj5SotJyKzouez1Q/image.png","https://images.hive.blog/0x0/https://files.peakd.com/file/peakd-hive/forykw/bQ2g7jrS-HIVE_2020_GAMES.png","https://crypto.com/images/cards_sg/card-page-rose-gold-93d09a29.png","https://cards.crypterium.com/static/img/pics/card.png","https://images.ctfassets.net/xecblntwky6m/4DuzIWlnDW40Ksg2euYQaq/6fdfb10cc614e737c677fe01115f84fc/productCard.png","https://steemitimages.com/640x0/http://res.cloudinary.com/oracle-d/image/upload/v1541428832/fv1minzyjesg10zetx2q.png","https://img.wirexapp.com/images/t_optimize_transf/v1573412547/wirexapp/wirex30/en/en-img-card-hero.png/img","https://files.peakd.com/file/peakd-hive/forykw/MNu9mnm4-1MKqGoh8-forykw.gif"],"links":["https://gitlab.syncad.com/groups/hive/-/activity","https://developers.hive.io/docs/apidefinitions/condenser-api.html#condenser_api.get_accounts","https://rpc.esteem.app","https://api.hive.blog","https://peakd.com/hive-148441/@forykw/2020-hive-blockchain-games-the-power-of-having-fun","https://twitter.com/forkyishere","https://platinum.crypto.com/r/hz3dzstewl","https://crypterium.app.link/UpvfysXUKY","https://webhooks.getonebit.com/api/wallet/share-link?source=edf4e92409a887b942968c6a4bd9180080935c2aa8490a7202caf65ecf6562c6","https://wirexapp.com/r/forykw"],"tags":["hive-139531","hive","python","jupyterlab","anaconda","coding"],"users":["doze","forkyishere","forykw"]}
created2020-10-11 06:28:30
last_update2020-10-11 06:47:30
depth0
children3
last_payout2020-10-18 06:28:30
cashout_time1969-12-31 23:59:59
total_payout_value0.810 HBD
curator_payout_value0.757 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,606
author_reputation34,630,817,596,454
root_title"My Progress to Orca in Python (using JupyterLab)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id100,057,891
net_rshares7,325,092,174,188
author_curate_reward""
vote details (73)
@ecency ·
Thanks for using **Ecency**! <br>Your post has been **voted** as a part of [Encouragement program](https://ecency.com/esteem/@good-karma/encouragement-program-continues-82eafcd10a299). Keep up the good work! <br>Dear readers, follow and support this author, Install Android: https://android.ecency.com, iOS: https://ios.ecency.com mobile app or desktop app for Windows, Mac, Linux: https://desktop.ecency.com<br>Learn more: https://ecency.com <br>Join our discord: https://discord.me/ecency
properties (22)
authorecency
permlinkre-20201013t12821211z
categoryhive-139531
json_metadata{"tags":["ecency"],"app":"ecency/3.0.5-welcome","format":"markdown+html"}
created2020-10-12 23:28:21
last_update2020-10-12 23:28:21
depth1
children0
last_payout2020-10-19 23:28:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length490
author_reputation77,893,510,697,817
root_title"My Progress to Orca in Python (using JupyterLab)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id100,084,489
net_rshares0
@poshbot ·
https://twitter.com/forkyishere/status/1315178329444503552
properties (22)
authorposhbot
permlinkre-my-progress-to-orca-in-python-using-jupyterlab-20201011t063238z
categoryhive-139531
json_metadata"{"app": "beem/0.24.8"}"
created2020-10-11 06:32:36
last_update2020-10-11 06:32:36
depth1
children0
last_payout2020-10-18 06:32:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length58
author_reputation1,255,186,088,821
root_title"My Progress to Orca in Python (using JupyterLab)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id100,057,917
net_rshares0
@poshbot ·
https://twitter.com/Bhattg18/status/1316064024686071808
properties (22)
authorposhbot
permlinkre-my-progress-to-orca-in-python-using-jupyterlab-20201013t171250z
categoryhive-139531
json_metadata"{"app": "beem/0.24.8"}"
created2020-10-13 17:12:51
last_update2020-10-13 17:12:51
depth1
children0
last_payout2020-10-20 17:12:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation1,255,186,088,821
root_title"My Progress to Orca in Python (using JupyterLab)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id100,094,438
net_rshares0