replace httplib with requests
This commit is contained in:
@@ -50,7 +50,6 @@ from qrtextedit import ScanQRTextEdit, ShowQRTextEdit
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
import httplib
|
||||
import socket
|
||||
import webbrowser
|
||||
import csv
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import threading, httplib, re, socket
|
||||
import threading, re, socket
|
||||
import webbrowser
|
||||
import requests
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import PyQt4.QtCore as QtCore
|
||||
@@ -34,15 +36,13 @@ class VersionGetter(threading.Thread):
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
con = httplib.HTTPSConnection('electrum.org', timeout=5)
|
||||
con.request("GET", "/version")
|
||||
res = con.getresponse()
|
||||
res = requests.request("GET", "https://electrum.org/version")
|
||||
except socket.error as msg:
|
||||
print_error("Could not retrieve version information")
|
||||
return
|
||||
|
||||
if res.status == 200:
|
||||
latest_version = res.read()
|
||||
if res.status_code == 200:
|
||||
latest_version = res.text
|
||||
latest_version = latest_version.replace("\n","")
|
||||
if(re.match('^\d+(\.\d+)*$', latest_version)):
|
||||
self.label.callback(latest_version)
|
||||
|
||||
Reference in New Issue
Block a user