commit 78f5afff7461830951245c971cec02e19d401edf
parent c09ac41b277e1d0c860b02f365c0f77bea449b81
Author: SomberNight <somber.night@protonmail.com>
Date: Thu, 13 Dec 2018 23:11:59 +0100
use certifi directly instead of requests
Diffstat:
6 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/contrib/requirements/requirements.txt b/contrib/requirements/requirements.txt
@@ -9,3 +9,4 @@ qdarkstyle<2.6
aiorpcx>=0.9,<0.11
aiohttp
aiohttp_socks
+certifi
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -33,7 +33,7 @@ from collections import defaultdict
import aiorpcx
from aiorpcx import RPCSession, Notification
-import requests
+import certifi
from .util import PrintError, ignore_exceptions, log_exceptions, bfh, SilentTaskGroup
from . import util
@@ -49,7 +49,7 @@ if TYPE_CHECKING:
from .network import Network
-ca_path = requests.certs.where()
+ca_path = certifi.where()
class NotificationSession(RPCSession):
diff --git a/electrum/paymentrequest.py b/electrum/paymentrequest.py
@@ -28,7 +28,7 @@ import time
import traceback
import json
-import requests
+import certifi
import urllib.parse
import aiohttp
@@ -49,7 +49,7 @@ from .network import Network
REQUEST_HEADERS = {'Accept': 'application/bitcoin-paymentrequest', 'User-Agent': 'Electrum'}
ACK_HEADERS = {'Content-Type':'application/bitcoin-payment','Accept':'application/bitcoin-paymentack','User-Agent':'Electrum'}
-ca_path = requests.certs.where() # FIXME do we need to depend on requests here?
+ca_path = certifi.where()
ca_list = None
ca_keyID = None
diff --git a/electrum/util.py b/electrum/util.py
@@ -45,7 +45,7 @@ import ssl
import aiohttp
from aiohttp_socks import SocksConnector, SocksVer
from aiorpcx import TaskGroup
-import requests
+import certifi
from .i18n import _
@@ -59,7 +59,7 @@ def inv_dict(d):
return {v: k for k, v in d.items()}
-ca_path = requests.certs.where()
+ca_path = certifi.where()
base_units = {'BTC':8, 'mBTC':5, 'bits':2, 'sat':0}
diff --git a/electrum/x509.py b/electrum/x509.py
@@ -337,8 +337,8 @@ def load_certificates(ca_path):
if __name__ == "__main__":
- import requests
+ import certifi
util.set_verbosity(True)
- ca_path = requests.certs.where()
+ ca_path = certifi.where()
ca_list, ca_keyID = load_certificates(ca_path)
diff --git a/run_electrum b/run_electrum
@@ -44,7 +44,7 @@ def check_imports():
import dns
import pyaes
import ecdsa
- import requests
+ import certifi
import qrcode
import google.protobuf
import jsonrpclib
@@ -58,7 +58,7 @@ def check_imports():
from google.protobuf import descriptor_pb2
from jsonrpclib import SimpleJSONRPCServer
# make sure that certificates are here
- assert os.path.exists(requests.utils.DEFAULT_CA_BUNDLE_PATH)
+ assert os.path.exists(certifi.where())
if not is_android: