mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 02:23:38 +00:00
Change pyNMA use of urllib to requests.
This commit is contained in:
parent
36b6335c7f
commit
9197566231
3 changed files with 5 additions and 14 deletions
|
@ -94,6 +94,7 @@
|
||||||
* Fix saving root dirs
|
* Fix saving root dirs
|
||||||
* Change pushbullet from urllib2 to requests
|
* Change pushbullet from urllib2 to requests
|
||||||
* Change to make pushbullet error messages clearer
|
* Change to make pushbullet error messages clearer
|
||||||
|
* Change pyNMA use of urllib to requests (ref:hacks.txt)
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
* Update Requests library 2.7.0 (ab1f493) to 2.7.0 (8b5e457)
|
* Update Requests library 2.7.0 (ab1f493) to 2.7.0 (8b5e457)
|
||||||
|
|
|
@ -4,3 +4,4 @@ Libs with customisations...
|
||||||
/lib/requests/packages/urllib3/connectionpool.py
|
/lib/requests/packages/urllib3/connectionpool.py
|
||||||
/lib/requests/packages/urllib3/util/ssl_.py
|
/lib/requests/packages/urllib3/util/ssl_.py
|
||||||
/lib/cachecontrol/caches/file_cache.py
|
/lib/cachecontrol/caches/file_cache.py
|
||||||
|
/lib/pynma/pynma.py
|
|
@ -3,15 +3,7 @@
|
||||||
from . import __version__
|
from . import __version__
|
||||||
from xml.dom.minidom import parseString
|
from xml.dom.minidom import parseString
|
||||||
|
|
||||||
try:
|
import requests
|
||||||
from http.client import HTTPSConnection
|
|
||||||
except ImportError:
|
|
||||||
from httplib import HTTPSConnection
|
|
||||||
|
|
||||||
try:
|
|
||||||
from urllib.parse import urlencode
|
|
||||||
except ImportError:
|
|
||||||
from urllib import urlencode
|
|
||||||
|
|
||||||
|
|
||||||
class PyNMA(object):
|
class PyNMA(object):
|
||||||
|
@ -126,12 +118,9 @@ class PyNMA(object):
|
||||||
if 'POST' == method:
|
if 'POST' == method:
|
||||||
headers['Content-type'] = 'application/x-www-form-urlencoded'
|
headers['Content-type'] = 'application/x-www-form-urlencoded'
|
||||||
|
|
||||||
http_handler = HTTPSConnection(self.api_server)
|
|
||||||
http_handler.request(method, path, urlencode(args), headers)
|
|
||||||
resp = http_handler.getresponse()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = self._parse_response(resp.read())
|
resp = requests.post('%s:443%s' % (self.api_server, path), data=args, headers=headers).text
|
||||||
|
res = self._parse_response(resp)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'type': 'pynmaerror',
|
res = {'type': 'pynmaerror',
|
||||||
'code': 600,
|
'code': 600,
|
||||||
|
|
Loading…
Reference in a new issue