Browse Source

Merge #582: Simple improvements for ob-watcher.py

6bd101ebb3 Remove link to old non segwit version and change new version link to use JoinMarket github organization (Kristaps Kaupe)
e8ec595d31 Shebang and +x for ob-watcher.py (Kristaps Kaupe)
80333b2872 Make ob-watcher independent of current working directory (Kristaps Kaupe)
8997147848 Terminate ob-watcher immediately if HTTP server fails to start (Kristaps Kaupe)

Pull request description:

  * Terminate immediately if HTTP server fails to start.
  * Make `ob-watcher.py` runnable from any directory.
  * Shebang and +x (like was done in #524 for other scripts).

Top commit has no ACKs.

Tree-SHA512: 92b622fc9ad7cc910c1fe354146287998348e26a94909d52961ab50c5c39e2db9707341c2ce5e1943e1b1d4d49a4ecc86cafdf395a88346a2f43f0ad0bc2283d
master
Kristaps Kaupe 6 years ago
parent
commit
018d45ef4d
No known key found for this signature in database
GPG Key ID: D47B1B4232B55437
  1. 10
      scripts/obwatch/ob-watcher.py
  2. 3
      scripts/obwatch/orderbook.html

10
scripts/obwatch/ob-watcher.py

@ -1,3 +1,4 @@
#!/usr/bin/env python3
from future.utils import iteritems
from past.builtins import cmp
from functools import cmp_to_key
@ -271,7 +272,8 @@ class OrderbookPageRequestHeader(http.server.SimpleHTTPRequestHandler):
pages = ['/', '/ordersize', '/depth', '/orderbook.json']
if self.path not in pages:
return
fd = open('orderbook.html', 'r')
fd = open(os.path.join(os.path.dirname(os.path.realpath(__file__)),
'orderbook.html'), 'r')
orderbook_fmt = fd.read()
fd.close()
alert_msg = ''
@ -372,8 +374,12 @@ class HTTPDThread(threading.Thread):
def run(self):
# hostport = ('localhost', 62601)
httpd = http.server.HTTPServer(self.hostport,
try:
httpd = http.server.HTTPServer(self.hostport,
OrderbookPageRequestHeader)
except Exception as e:
print("Failed to start HTTP server: " + str(e))
os._exit(EXIT_FAILURE)
httpd.taker = self.taker
print('\nstarted http server, visit http://{0}:{1}/\n'.format(
*self.hostport))

3
scripts/obwatch/orderbook.html

@ -86,8 +86,7 @@
<li><a href="/ordersize">Size Distribution</a></li>
<li><a href="/depth">Depth</a></li>
<li><a href="/orderbook.json">Export orders</a></li>
<li><a target="_blank" href="https://github.com/AdamISZ/joinmarket-clientserver/releases">New segwit version</a></li>
<li><a target="_blank" href="https://github.com/Joinmarket-Org/joinmarket/releases">Non segwit version</a></li>
<li><a target="_blank" href="https://github.com/JoinMarket-Org/joinmarket-clientserver/releases">New segwit version</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>

Loading…
Cancel
Save