SHARE
TWEET

btc-update.py

a guest Feb 13th, 2014 1,851 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. from bitcoinrpc.authproxy import AuthServiceProxy
  3. import time
  4.  
  5. access = AuthServiceProxy("http://RPCUSER:PRCPASSWORD@127.0.0.1:8332")
  6. info = access.getinfo()
  7.  
  8. ff = open('/var/www/index.html', 'w')
  9.  
  10.  
  11. ff.write("<!DOCTYPE html>")
  12. ff.write("<html lang='en-us'>")
  13. ff.write("<head>")
  14. ff.write("<meta charset='utf-8'>")
  15. ff.write("<title>Bitcoin Node Status</title>")
  16. ff.write("<link href='http://fonts.googleapis.com/css?family=Exo+2:300,400' rel='stylesheet' type='text/css'>")
  17. ff.write("<style type='text/css'> ")
  18. ff.write("</style>")
  19. ff.write("</head>")
  20. ff.write("<body>")
  21.  
  22. ff.write("<link href='http://fonts.googleapis.com/css?family=Exo+2:300,400' rel='stylesheet' type='text/css'>")
  23. ff.write("<style>")
  24.  
  25. ff.write("/* Eric Meyer's Reset CSS v2.0 - http://cssreset.com */")
  26. ff.write("html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}")
  27.  
  28. ff.write("html,body{height:100%;}")
  29. ff.write("body{")
  30. ff.write("color: #444;")
  31. ff.write("background: url(http://www.babayara.com/wp-content/uploads/2013/08/vlcsnap-2013-08-24-23h14m34s7.png) no-repeat;")
  32. ff.write("}")
  33.  
  34. ff.write("#wrap{")
  35. ff.write("background-color: rgba(255, 255, 255, 0.6);")
  36. ff.write("width: 100%;")
  37. ff.write("height: 100%;")
  38. ff.write("padding-top: 50px;")
  39. ff.write("padding-left: 50px;")
  40. ff.write("line-height: 1.4;")
  41. ff.write("font-size: 24px;")
  42. ff.write("font-family: 'Exo 2', sans-serif;")
  43. ff.write("}")
  44.  
  45. ff.write("h3{")
  46. ff.write("font-weight: 300;")
  47. ff.write("}")
  48.  
  49. ff.write("h1{")
  50. ff.write("font-weight: 400;")
  51. ff.write("margin-bottom: 15px;")
  52. ff.write("}")
  53. ff.write("</style>")
  54. ff.write("<div id='wrap'>")
  55. ff.write("<h1>Bitcoin Node: NODE_IP_ADDRESS:8333<br \></h1>")
  56. ff.write("<h3>")
  57.  
  58. ff.write("Last Update: " + time.strftime("%H:%M:%S %Y-%m-%d") + "<br \>\n")
  59. ff.write("Connections: " + str(info['connections']) + "<br \>\n")
  60. ff.write("Blocks: " + str(info['blocks']) + "<br \>\n")
  61. ff.write("Difficulty: " + str(info['difficulty']) + "<br \>\n")
  62.  
  63. ff.write("Location: New York")
  64. ff.write("</h3>")
  65. ff.write("<a href='https://blockchain.info/address/BITCOIN_DONATION_ADDRESS'><img src='http://qrfree.kaywa.com/?l=1&amp;s=4&amp;d=BITCOIN_DONATION_ADDRESS' alt='QRCode'></a>")
  66. ff.write("</div>")
  67. ff.write("</body></html>")
  68.  
  69. ff.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top