ut_dep.py 499 B

12345678910111213141516171819202122
  1. #!/usr/bin/env python3
  2. """
  3. test.unit_tests_d.ut_rpc: dependency unit tests for the MMGen suite
  4. """
  5. from mmgen.common import *
  6. class unit_tests:
  7. def pysocks(self,name,ut):
  8. import requests,urllib3
  9. urllib3.disable_warnings()
  10. session = requests.Session()
  11. session.proxies.update({'https':'socks5h://127.243.172.8:20677'})
  12. try:
  13. session.get('https://127.188.29.17')
  14. except Exception as e:
  15. if type(e).__name__ == 'ConnectionError':
  16. return True
  17. else:
  18. print(e)
  19. return False