Skip to content

Commit

Permalink
use dnfpluginscore.lib.urlopen() (RhBug:1193047)
Browse files Browse the repository at this point in the history
the FancyURLopener() does not work under python3
and urlopen() is ultimative way, because it respect proxy settings etc.
  • Loading branch information
xsuchy committed Mar 6, 2015
1 parent 1971b3c commit 331fec3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions plugins/copr.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from __future__ import print_function
from dnfpluginscore import _, logger
from dnf.i18n import ucd
import dnfpluginscore.lib

import dnf
import glob
Expand Down Expand Up @@ -118,8 +119,7 @@ def run(self, extcmds):
#http://copr.fedoraproject.org/api/coprs/ignatenkobrain/
api_path = "/api/coprs/{}/".format(project_name)

opener = urllib.FancyURLopener({})
res = opener.open(self.copr_url + api_path)
res = dnfpluginscore.lib.urlopen(self, None, self.copr_url + api_path, 'w+')
try:
json_parse = json.loads(res.read())
except ValueError:
Expand All @@ -143,8 +143,7 @@ def run(self, extcmds):
#http://copr.fedoraproject.org/api/coprs/search/tests/
api_path = "/api/coprs/search/{}/".format(project_name)

opener = urllib.FancyURLopener({})
res = opener.open(self.copr_url + api_path)
res = dnfpluginscore.lib.urlopen(self, None, self.copr_url + api_path, 'w+')
try:
json_parse = json.loads(res.read())
except ValueError:
Expand Down

0 comments on commit 331fec3

Please sign in to comment.