-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblockclock_mini_public.py
More file actions
55 lines (45 loc) · 1.28 KB
/
Copy pathblockclock_mini_public.py
File metadata and controls
55 lines (45 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 14 23:47:06 2022
@author: KevinR4v - Noderunner
"""
import requests
# Blockclock Mini local network name/address
address = input('Enter BlockClock Mini address (example 192.168.x.x):\n')
# Blockclock Mini password:
bc_pass = input('Enter BlockClock Mini password:\n')
# Text to display:
text = ''
# Or choose number to display:
number = '1'
pair = 'BTC/BTC'
sym = 'bitcoin'
tl = 'one bitcoin'
br = 'equals one btc'
URL = f'http://{address}/api/'
if text:
URL += 'show/text/{}'.format(text)
elif number:
URL += f'show/number/{number}'
if pair:
URL += f'?pair={pair}'
if sym:
URL += f'&sym={sym}'
if tl:
URL += f'&tl={tl}'
if br:
URL += f'&br={br}'
# Show generated URL:
print('\n Generated URL:',URL)
# Generate login token with password:
login = requests.auth.HTTPDigestAuth('admin', bc_pass)
# Update Blockclock mini with URL:
requests = requests.get(URL, auth=login)
# Show response:
#print(requests.text) # use this for debugging
happy = requests.text
if happy.split(',')[-1] == ' "status": "Worked"}\n\n':
print('\n Happy BlockClock!')
else:
print('\n Sad BlockClock... try again')
print(happy.split(':')[-1].replace('}',''))