mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-31 20:26:13 +01:00
- fix for older python versions
This commit is contained in:
parent
287d8c2fbd
commit
fb992a24fc
@ -22,6 +22,7 @@ import oscerr
|
|||||||
import conf
|
import conf
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
|
import socket
|
||||||
try:
|
try:
|
||||||
from xml.etree import cElementTree as ET
|
from xml.etree import cElementTree as ET
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -1538,9 +1539,12 @@ def http_request(method, url, headers={}, data=None, file=None, timeout=100):
|
|||||||
|
|
||||||
if conf.config['debug']: print method, url
|
if conf.config['debug']: print method, url
|
||||||
|
|
||||||
|
old_timeout = socket.getdefaulttimeout()
|
||||||
|
socket.setdefaulttimeout(timeout)
|
||||||
try:
|
try:
|
||||||
fd = urllib2.urlopen(req, data=data, timeout=timeout)
|
fd = urllib2.urlopen(req, data=data)
|
||||||
finally:
|
finally:
|
||||||
|
socket.setdefaulttimeout(old_timeout)
|
||||||
if hasattr(conf.cookiejar, 'save'):
|
if hasattr(conf.cookiejar, 'save'):
|
||||||
conf.cookiejar.save(ignore_discard=True)
|
conf.cookiejar.save(ignore_discard=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user