Use custom urlencode function. fixes #121

This commit is contained in:
Ruud committed 2012-04-21 20:55:21 +02:00
1 parent 8b80c50d89
commit fd462514c3
22 files changed
+79 -66

No files matched your search

+2 -3
View File
@@ -1,12 +1,11 @@
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.request import getParams, jsonified
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
from couchpotato.environment import Env
import re
import telnetlib
import urllib
try:
import xml.etree.cElementTree as etree
@@ -90,7 +89,7 @@ class NMJ(Notification):
'arg2': 'background',
'arg3': '',
}
params = urllib.urlencode(params)
params = tryUrlencode(params)
UPDATE_URL = 'http://%(host)s:8008/metadata_database?%(params)s'
updateUrl = UPDATE_URL % {'host': host, 'params': params}
+2 -3
View File
@@ -1,8 +1,7 @@
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
from httplib import HTTPSConnection
from urllib import urlencode
log = CPLog(__name__)
@@ -24,7 +23,7 @@ class Prowl(Notification):
http_handler.request('POST',
'/publicapi/add',
headers = {'Content-type': 'application/x-www-form-urlencoded'},
body = urlencode(data)
body = tryUrlencode(data)
)
response = http_handler.getresponse()
request_status = response.status
@@ -1,4 +1,5 @@
from couchpotato.api import addApiView
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.request import jsonified, getParam
from couchpotato.core.helpers.variable import cleanHost
from couchpotato.core.logger import CPLog
@@ -7,7 +8,6 @@ from flask.helpers import url_for
from pytwitter import Api, parse_qsl
from werkzeug.utils import redirect
import oauth2
import urllib
log = CPLog(__name__)
@@ -56,7 +56,7 @@ class Twitter(Notification):
oauth_consumer = oauth2.Consumer(self.consumer_key, self.consumer_secret)
oauth_client = oauth2.Client(oauth_consumer)
resp, content = oauth_client.request(self.urls['request'], 'POST', body = urllib.urlencode({'oauth_callback': callback_url}))
resp, content = oauth_client.request(self.urls['request'], 'POST', body = tryUrlencode({'oauth_callback': callback_url}))
if resp['status'] != '200':
log.error('Invalid response from Twitter requesting temp token: %s' % resp['status'])
+2 -2
View File
@@ -1,7 +1,7 @@
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
import base64
import urllib
log = CPLog(__name__)
@@ -21,7 +21,7 @@ class XBMC(Notification):
def send(self, command, host):
url = 'http://%s/xbmcCmds/xbmcHttp/?%s' % (host, urllib.urlencode(command))
url = 'http://%s/xbmcCmds/xbmcHttp/?%s' % (host, tryUrlencode(command))
headers = {}
if self.conf('password'):