Support for Python 2.4:

- Use md5.md5 when hashlib.md5 is not available
This commit is contained in:
Grey Lee 2013-01-12 22:22:11 +08:00
parent 76cd7d238f
commit f3bdb7257c
1 changed files with 7 additions and 4 deletions

View File

@ -25,7 +25,10 @@ from xml.dom import minidom as DOM
import time import time
import os import os
import sys import sys
import hashlib try:
from hashlib import md5
except:
from md5 import md5
import threading import threading
from Queue import Queue from Queue import Queue
@ -280,7 +283,7 @@ def speedtest():
'recommendedserverid=%s' % best['id'], 'recommendedserverid=%s' % best['id'],
'accuracy=%s' % 1, 'accuracy=%s' % 1,
'serverid=%s' % best['id'], 'serverid=%s' % best['id'],
'hash=%s' % hashlib.md5('%s-%s-%s-%s' % 'hash=%s' % md5('%s-%s-%s-%s' %
(ping, ulspeedk, dlspeedk, '297aae72') (ping, ulspeedk, dlspeedk, '297aae72')
).hexdigest()] ).hexdigest()]