|
37 | 37 | try: |
38 | 38 | # python 3 |
39 | 39 | from urllib.parse import urlparse, urlunparse, urlencode, quote_plus |
40 | | - from urllib.request import urlopen |
41 | 40 | from urllib.request import __version__ as urllib_version |
42 | 41 | except ImportError: |
43 | 42 | from urlparse import urlparse, urlunparse |
44 | | - from urllib2 import urlopen |
45 | 43 | from urllib import urlencode, quote_plus |
46 | 44 | from urllib import __version__ as urllib_version |
47 | 45 |
|
@@ -1445,14 +1443,14 @@ def _TweetTextWrap(self, |
1445 | 1443 |
|
1446 | 1444 | if len(words) == 1 and not is_url(words[0]): |
1447 | 1445 | if len(words[0]) > CHARACTER_LIMIT: |
1448 | | - raise TwitterError({"message": "Unable to split status into tweetable parts. Word was: {0}/{1}".format(len(words[0]), char_lim)}) |
| 1446 | + raise TwitterError("Unable to split status into tweetable parts. Word was: {0}/{1}".format(len(words[0]), char_lim)) |
1449 | 1447 | else: |
1450 | 1448 | tweets.append(words[0]) |
1451 | 1449 | return tweets |
1452 | 1450 |
|
1453 | 1451 | for word in words: |
1454 | 1452 | if len(word) > char_lim: |
1455 | | - raise TwitterError({"message": "Unable to split status into tweetable parts. Word was: {0}/{1}".format(len(word), char_lim)}) |
| 1453 | + raise TwitterError("Unable to split status into tweetable parts. Word was: {0}/{1}".format(len(word), char_lim)) |
1456 | 1454 | new_len = line_length |
1457 | 1455 |
|
1458 | 1456 | if is_url(word): |
@@ -1569,8 +1567,13 @@ def GetUserRetweets(self, |
1569 | 1567 | Returns: |
1570 | 1568 | A sequence of twitter.Status instances, one for each message up to count |
1571 | 1569 | """ |
1572 | | - return self.GetUserTimeline(since_id=since_id, count=count, max_id=max_id, trim_user=trim_user, |
1573 | | - exclude_replies=True, include_rts=True) |
| 1570 | + return self.GetUserTimeline( |
| 1571 | + since_id=since_id, |
| 1572 | + count=count, |
| 1573 | + max_id=max_id, |
| 1574 | + trim_user=trim_user, |
| 1575 | + exclude_replies=True, |
| 1576 | + include_rts=True) |
1574 | 1577 |
|
1575 | 1578 | def GetReplies(self, |
1576 | 1579 | since_id=None, |
@@ -4808,10 +4811,10 @@ def _BuildUrl(self, url, path_elements=None, extra_params=None): |
4808 | 4811 | # Add any additional path elements to the path |
4809 | 4812 | if path_elements: |
4810 | 4813 | # Filter out the path elements that have a value of None |
4811 | | - p = [i for i in path_elements if i] |
| 4814 | + filtered_elements = [i for i in path_elements if i] |
4812 | 4815 | if not path.endswith('/'): |
4813 | 4816 | path += '/' |
4814 | | - path += '/'.join(p) |
| 4817 | + path += '/'.join(filtered_elements) |
4815 | 4818 |
|
4816 | 4819 | # Add any additional query parameters to the query string |
4817 | 4820 | if extra_params and len(extra_params) > 0: |
|
0 commit comments