Private GIT

Skip to content
Snippets Groups Projects
Commit a95d5ca9 authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Limit twitter messages to 140 chars

parent fa18bcde
Branches
Tags
No related merge requests found
...@@ -24,7 +24,7 @@ from sickrage.helper.exceptions import ex ...@@ -24,7 +24,7 @@ from sickrage.helper.exceptions import ex
# parse_qsl moved to urlparse module in v2.6 # parse_qsl moved to urlparse module in v2.6
try: try:
from urlparse import parse_qsl #@UnusedImport from urlparse import parse_qsl #@UnusedImport
except: except ImportError:
from cgi import parse_qsl #@Reimport from cgi import parse_qsl #@Reimport
import oauth2 as oauth import oauth2 as oauth
...@@ -128,7 +128,7 @@ class TwitterNotifier: ...@@ -128,7 +128,7 @@ class TwitterNotifier:
api = twitter.Api(username, password, access_token_key, access_token_secret) api = twitter.Api(username, password, access_token_key, access_token_secret)
try: try:
api.PostUpdate(message.encode('utf8')) api.PostUpdate(message.encode('utf8')[:139])
except Exception, e: except Exception, e:
logger.log(u"Error Sending Tweet: " + ex(e), logger.ERROR) logger.log(u"Error Sending Tweet: " + ex(e), logger.ERROR)
return False return False
...@@ -148,7 +148,7 @@ class TwitterNotifier: ...@@ -148,7 +148,7 @@ class TwitterNotifier:
api = twitter.Api(username, password, access_token_key, access_token_secret) api = twitter.Api(username, password, access_token_key, access_token_secret)
try: try:
api.PostDirectMessage(dmdest, message.encode('utf8')) api.PostDirectMessage(dmdest, message.encode('utf8')[:139])
except Exception, e: except Exception, e:
logger.log(u"Error Sending Tweet (DM): " + ex(e), logger.ERROR) logger.log(u"Error Sending Tweet (DM): " + ex(e), logger.ERROR)
return False return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment