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 os
import sys
import hashlib
try:
from hashlib import md5
except:
from md5 import md5
import threading
from Queue import Queue
@ -280,9 +283,9 @@ def speedtest():
'recommendedserverid=%s' % best['id'],
'accuracy=%s' % 1,
'serverid=%s' % best['id'],
'hash=%s' % hashlib.md5('%s-%s-%s-%s' %
(ping, ulspeedk, dlspeedk, '297aae72')
).hexdigest()]
'hash=%s' % md5('%s-%s-%s-%s' %
(ping, ulspeedk, dlspeedk, '297aae72')
).hexdigest()]
req = urllib2.Request('http://www.speedtest.net/api/api.php',
data='&'.join(apiData))