Skip to content

Commit 5d70de0

Browse files
authored
Create getinfo.py
1 parent cec9f89 commit 5d70de0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

getinfo.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# -*- coding: UTF-8 -*-
2+
3+
# Get head block id's last two digit
4+
# as lucky number
5+
6+
import urllib.request
7+
import json
8+
9+
url = 'http://api.eosnewyork.io/v1/chain/get_info'
10+
11+
def make_request():
12+
response = urllib.request.urlopen(url)
13+
info = response.read().decode('utf8', "ignore")
14+
return info
15+
16+
if __name__ == '__main__':
17+
while 1:
18+
info = make_request()
19+
resp = json.loads(info)
20+
hash = resp["head_block_id"]
21+
index = 63
22+
dst = ""
23+
while index:
24+
c = hash[index]
25+
if c.isdigit():
26+
tmp = dst
27+
dst = c + tmp
28+
29+
if len(dst) == 2:
30+
break
31+
index -= 1
32+
print("lucky number is: %s" % dst)

0 commit comments

Comments
 (0)