etherscan.py 734 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2025 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. """
  11. test.cmdtest_d.httpd.etherscan: Etherscan WSGI http server
  12. """
  13. from . import HTTPD
  14. class EtherscanServer(HTTPD):
  15. name = 'etherscan server'
  16. port = 28800
  17. content_type = 'text/html'
  18. def make_response_body(self, method, environ):
  19. targets = {'GET': 'form', 'POST': 'result'}
  20. with open(f'test/ref/ethereum/etherscan-{targets[method]}.html') as fh:
  21. return fh.read().encode()