|
20 | 20 | from __future__ import division |
21 | 21 | from __future__ import print_function |
22 | 22 |
|
| 23 | +import json |
23 | 24 | import sys |
24 | 25 | import gzip |
25 | 26 | import time |
|
43 | 44 | from urllib import urlencode |
44 | 45 | from urllib import __version__ as urllib_version |
45 | 46 |
|
46 | | -from twitter import (__version__, _FileCache, json, DirectMessage, List, |
47 | | - Status, Trend, TwitterError, User, UserStatus, Category) |
| 47 | +from twitter import ( |
| 48 | + __version__, |
| 49 | + _FileCache, |
| 50 | + Category, |
| 51 | + DirectMessage, |
| 52 | + List, |
| 53 | + Status, |
| 54 | + Trend, |
| 55 | + User, |
| 56 | + UserStatus, |
| 57 | +) |
48 | 58 |
|
49 | 59 | from twitter.ratelimit import RateLimit |
50 | 60 |
|
|
54 | 64 | parse_media_file, |
55 | 65 | enf_type) |
56 | 66 |
|
| 67 | +from twitter.error import ( |
| 68 | + TwitterError, |
| 69 | + PythonTwitterDeprecationWarning330, |
| 70 | +) |
| 71 | + |
57 | 72 |
|
58 | 73 | warnings.simplefilter('always', DeprecationWarning) |
59 | 74 |
|
@@ -1299,7 +1314,7 @@ def PostMedia(self, |
1299 | 1314 | "PostUpdate() instead. Details of Twitter's deprecation can be " |
1300 | 1315 | "found at: " |
1301 | 1316 | "dev.twitter.com/rest/reference/post/statuses/update_with_media"), |
1302 | | - DeprecationWarning) |
| 1317 | + PythonTwitterDeprecationWarning330) |
1303 | 1318 |
|
1304 | 1319 | url = '%s/statuses/update_with_media.json' % self.base_url |
1305 | 1320 |
|
@@ -1366,7 +1381,7 @@ def PostMultipleMedia(self, status, media, possibly_sensitive=None, |
1366 | 1381 | warnings.warn(( |
1367 | 1382 | "This method is deprecated. Please use PostUpdate instead, " |
1368 | 1383 | "passing a list of media that you would like to associate " |
1369 | | - "with the updated."), DeprecationWarning, stacklevel=2) |
| 1384 | + "with the update."), PythonTwitterDeprecationWarning330) |
1370 | 1385 | if type(media) is not list: |
1371 | 1386 | raise TwitterError("Must by multiple media elements") |
1372 | 1387 |
|
@@ -2613,8 +2628,9 @@ def _GetFriendsFollowers(self, |
2613 | 2628 | if cursor is not None or count is not None: |
2614 | 2629 | warnings.warn( |
2615 | 2630 | "Use of 'cursor' and 'count' parameters are deprecated as of " |
2616 | | - "python-twitter 3.0. Please use GetFriendsPaged instead.", |
2617 | | - DeprecationWarning, stacklevel=2) |
| 2631 | + "python-twitter 3.0. Please use GetFriendsPaged or " |
| 2632 | + "GetFollowersPaged instead.", |
| 2633 | + PythonTwitterDeprecationWarning330) |
2618 | 2634 |
|
2619 | 2635 | count = 200 |
2620 | 2636 | cursor = -1 |
@@ -4320,6 +4336,10 @@ def UpdateBackgroundImage(self, |
4320 | 4336 | include_entities=False, |
4321 | 4337 | skip_status=False): |
4322 | 4338 |
|
| 4339 | + warnings.warn(( |
| 4340 | + "This method has been deprecated by Twitter as of July 2015 and " |
| 4341 | + "will be removed in future versions of python-twitter."), |
| 4342 | + PythonTwitterDeprecationWarning330) |
4323 | 4343 | url = '%s/account/update_profile_background_image.json' % (self.base_url) |
4324 | 4344 | with open(image, 'rb') as image_file: |
4325 | 4345 | encoded_image = base64.b64encode(image_file.read()) |
|
0 commit comments