Skip to content

Commit 5b92506

Browse files
author
Garland Trice
authored
Merge pull request #1 from bear/master
Update fork
2 parents 0b1e207 + 72123ab commit 5b92506

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1361
-890
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Now it's a full-on open source project with many contributors over time:
2121
* Pradeep Nayak,
2222
* Ian Ozsvald,
2323
* Nicolas Perriault,
24+
* Trevor Prater,
2425
* Glen Tregoning,
2526
* Lars Weiler,
2627
* Sebastian Wiesinger,

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
See the messy details at https://github.com/bear/python-twitter/pull/251
77

88
Pull Requests
9+
#525 Adds support for 280 character limit for tweets by trevorprater
910
#267 initialize Api.__auth fixes #119 by rbpasker
1011
#266 Add full_text and page options in GetDirectMessages function by mistersalmon
1112
#264 Updates Media object with new methods, adds id param, adds tests by jeremylow
@@ -24,6 +25,9 @@
2425

2526
Probably a whole lot that I missed - ugh!
2627

28+
2017-11-11
29+
Added support for 280 character limit
30+
2731
2015-10-05
2832
Added who to api.GetSearch
2933

GAE.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Google App Engine uses virtual machines to do work and serve your application's
1313
Prerequisites
1414
*************
1515

16-
Follow the `third party vendor library install instructions <https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27#vendoring>`_ to include the two dependency libraries listed in ``requirements.txt``: ``requests`` and ``requests_oauthlib``, as well as this ``python-twitter`` library. Typically you can just place the three module folders into the same place as your app.yaml file; it might look something like this:
16+
Follow the `third party vendor library install instructions <https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27#vendoring>`_ to include the dependency libraries listed in ``requirements.txt``: ``requests``, ``requests_oauthlib`` and ``requests_toolbelt``, as well as ``python-twitter`` library. Typically you can just place the module folders into the same place as your app.yaml file; it might look something like this:
1717

1818
| myapp/
1919
| ├── twitter/
@@ -52,4 +52,4 @@ If you plan to store tweets or other information returned by the API in Datastor
5252

5353
Sockets
5454
^^^^^^^^^
55-
When urllib3 is imported on App Engine it will throw a warning about sockets: ``AppEnginePlatformWarning: urllib3 is using URLFetch on Google App Engine sandbox...`` This is just a warning that you'd have to use the Sockets API if you intend to use the sockets feature of the library, which we don't use in python-twitter so it can be ignored.
55+
When urllib3 is imported on App Engine it will throw a warning about sockets: ``AppEnginePlatformWarning: urllib3 is using URLFetch on Google App Engine sandbox...`` This is just a warning that you'd have to use the Sockets API if you intend to use the sockets feature of the library, which we don't use in python-twitter so it can be ignored.

doc/changelog.rst

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
11
Changelog
22
---------
33

4+
Version 3.4.1
5+
=============
6+
7+
Bugfixes:
8+
9+
* Fix an issue where :py:func:`twitter.twitter_utils.calc_expected_status_length` was failing for python 2 due to a failure to convert a bytes string to unicode. `Github issue #546 <https://github.com/bear/python-twitter/issues/546>`_.
10+
11+
* Documentation fix for :py:func:`twitter.api.Api.UsersLookup`. UsersLookup can take a string or a list and properly parses both of them now. Github issues `#535 <https://github.com/bear/python-twitter/issues/535>`_ and `#549 <https://github.com/bear/python-twitter/issues/549>`_.
12+
13+
* Properly decode response content for :py:func:`twitter.twitter_utils.http_to_file`. `Github issue #521 <https://github.com/bear/python-twitter/issues/521>`_.
14+
15+
* Fix an issue with loading extended_tweet entities from Streaming API where tweets would be truncated when converting to a :py:class:`twitter.models.Status`. Github issues `#491 <https://github.com/bear/python-twitter/issues/491>`_ and `#506 <https://github.com/bear/python-twitter/issues/506>`_.
16+
17+
Version 3.4
18+
===========
19+
20+
Deprecations
21+
++++++++++++
22+
23+
* :py:func:`twitter.api.Api.UpdateBackgroundImage`. Please make sure that your code does not call this function as it will now return a hard error. There is no replacement function. This was deprecated by Twitter around July 2015.
24+
25+
* :py:func:`twitter.api.Api.PostMedia` has been removed. Please use :py:func:`twitter.api.Api.PostUpdate` instead.
26+
27+
* :py:func:`twitter.api.Api.PostMultipleMedia`. Please use :py:func:`twitter.api.Api.PostUpdate` instead.
28+
29+
30+
Version 3.3.1
31+
=============
32+
33+
* Adds support for 280 character limit.
34+
35+
36+
Version 3.3
37+
=============
38+
39+
* Adds application only authentication. See `Twitter's documentation for details <https://dev.twitter.com/oauth/application-only>`_. To use application only authentication, pass `application_only_auth` when creating the Api; the bearer token will be automatically retrieved.
40+
41+
* Adds function :py:func:`twitter.api.GetAppOnlyAuthToken`
42+
43+
* Adds `filter_level` keyword argument for :py:func:`twitter.api.GetStreamFilter`, :py:func:`twitter.api.GetUserStream`
44+
45+
* Adds `proxies` keyword argument for creating an Api instance. Pass a dictionary of proxies for the request to pass through, if not specified allows requests lib to use environmental variables for proxy if any.
46+
47+
* Adds support for `quoted_status` to the :py:class:`twitter.models.Status` model.
48+
49+
450
Version 3.2.1
551
=============
652

@@ -13,7 +59,7 @@ Version 3.2
1359
===========
1460

1561
Deprecations
16-
------------
62+
++++++++++++
1763

1864
Nothing is being deprecationed this version, however here's what's being deprecated as of v. 3.3.0:
1965

@@ -29,7 +75,7 @@ Nothing is being deprecationed this version, however here's what's being depreca
2975

3076

3177
What's New
32-
----------
78+
++++++++++
3379

3480
* We've added new deprecation warnings, so it's easier to track when things go away. All of python-twitter's deprecation warnings will be a subclass of :py:class:`twitter.error.PythonTwitterDeprecationWarning` and will have a version number associated with them such as :py:class:`twitter.error.PythonTwitterDeprecationWarning330`.
3581

@@ -47,7 +93,7 @@ What's New
4793
* `video_info` is now available on a `twitter.models.Media` object, which allows access to video urls/bitrates/etc. in the `extended_entities` node of a tweet.
4894

4995
What's Changed
50-
--------------
96+
++++++++++++++
5197

5298
* :py:class:`twitter.models.Trend`'s `volume` attribute has been renamed `tweet_volume` in line with Twitter's naming convention. This change should allow users to access the number of tweets being tweeted for a given Trend. `PR #375 <https://github.com/bear/python-twitter/pull/375>`_
5399

@@ -57,7 +103,7 @@ What's Changed
57103

58104

59105
Bugfixes
60-
--------
106+
++++++++
61107

62108
* :py:class:`twitter.models.Media` again contains a ``sizes`` attribute, which was missed back in the Version 3.0 release. `PR #360 <https://github.com/bear/python-twitter/pull/360>`_
63109

@@ -73,7 +119,7 @@ Version 3.1
73119
==========
74120

75121
What's New
76-
____________
122+
++++++++++
77123

78124
* :py:func:`twitter.api.Api.PostMediaMetadata()` Method allows the posting of alt text (hover text) to a photo on Twitter. Note that it appears that you have to call this method prior to attaching the photo to a status.
79125

@@ -92,7 +138,7 @@ ____________
92138

93139

94140
What's Changed
95-
______________
141+
++++++++++++++
96142

97143
* :py:func:`twitter.api.Api.GetStatus()` Now accepts the keyword argument ``include_ext_alt_text`` which will request alt text to be included with the Status object being returned (if available). Defaults to ``True``.
98144

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
# built documents.
5858
#
5959
# The short X.Y version.
60-
version = '3.2'
60+
version = '3.4.1'
6161
# The full version, including alpha/beta/rc tags.
62-
release = '3.2.1'
62+
release = '3.4.1'
6363

6464
# The language for content autogenerated by Sphinx. Refer to documentation
6565
# for a list of supported languages.

examples/tweet.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@
44

55
__author__ = '[email protected]'
66

7-
import configparser
7+
from __future__ import print_function
8+
9+
try:
10+
import configparser
11+
except ImportError as _:
12+
import ConfigParser as configparser
13+
814
import getopt
915
import os
1016
import sys
1117
import twitter
1218

1319

20+
1421
USAGE = '''Usage: tweet [options] message
1522
1623
This script posts a message to Twitter.
@@ -48,7 +55,7 @@
4855

4956

5057
def PrintUsageAndExit():
51-
print USAGE
58+
print(USAGE)
5259
sys.exit(2)
5360

5461

@@ -139,11 +146,11 @@ def main():
139146
try:
140147
status = api.PostUpdate(message)
141148
except UnicodeDecodeError:
142-
print "Your message could not be encoded. Perhaps it contains non-ASCII characters? "
143-
print "Try explicitly specifying the encoding with the --encoding flag"
149+
print("Your message could not be encoded. Perhaps it contains non-ASCII characters? ")
150+
print("Try explicitly specifying the encoding with the --encoding flag")
144151
sys.exit(2)
145-
print "%s just posted: %s" % (status.user.name, status.text)
146152

153+
print("{0} just posted: {1}".format(status.user.name, status.text))
147154

148155
if __name__ == "__main__":
149156
main()

requirements.testing.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ check-manifest
1616
tox
1717
tox-pyenv
1818
pycodestyle
19+
20+
hypothesis

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[aliases]
22
test = pytest
33

4+
[bdist_wheel]
5+
universal=1
6+
47
[check-manifest]
58
ignore =
69
.travis.yml

testdata/create_friendship.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"id":2425151,"id_str":"2425151","name":"Facebook","screen_name":"facebook","location":"Menlo Park, California","description":"Give people the power to build community and bring the world closer together.","url":"http:\/\/t.co\/7bZ2KCQJ2k","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/7bZ2KCQJ2k","expanded_url":"http:\/\/facebook.com","display_url":"facebook.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":14034525,"friends_count":92,"listed_count":43686,"created_at":"Tue Mar 27 07:29:25 +0000 2007","favourites_count":430,"utc_offset":-28800,"time_zone":"Pacific Time (US & Canada)","geo_enabled":false,"verified":true,"statuses_count":8481,"lang":"en","status":{"created_at":"Fri Dec 15 22:36:04 +0000 2017","id":941799043407269888,"id_str":"941799043407269888","text":"@adambungle Hi Adam. If there's already a Facebook account associated with your email address, please fill out this\u2026 https:\/\/t.co\/KJEGff3Sp8","truncated":true,"entities":{"hashtags":[],"symbols":[],"user_mentions":[{"screen_name":"adambungle","name":"Adam Forster","id":212532742,"id_str":"212532742","indices":[0,11]}],"urls":[{"url":"https:\/\/t.co\/KJEGff3Sp8","expanded_url":"https:\/\/twitter.com\/i\/web\/status\/941799043407269888","display_url":"twitter.com\/i\/web\/status\/9\u2026","indices":[117,140]}]},"source":"\u003ca href=\"http:\/\/www.spredfast.com\" rel=\"nofollow\"\u003eSpredfast app\u003c\/a\u003e","in_reply_to_status_id":941231370600435712,"in_reply_to_status_id_str":"941231370600435712","in_reply_to_user_id":212532742,"in_reply_to_user_id_str":"212532742","in_reply_to_screen_name":"adambungle","geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":1,"favorite_count":4,"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},"contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"3C5A99","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/4699594\/quail_air_background.png","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/4699594\/quail_air_background.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/3513354941\/24aaffa670e634a7da9a087bfa83abe6_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/3513354941\/24aaffa670e634a7da9a087bfa83abe6_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2425151\/1506715336","profile_link_color":"3C5A99","profile_sidebar_border_color":"DEDEDE","profile_sidebar_fill_color":"FFFFFF","profile_text_color":"000000","profile_use_background_image":true,"has_extended_profile":false,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false,"muting":false,"translator_type":"regular"}

testdata/destroy_friendship.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"id":2425151,"id_str":"2425151","name":"Facebook","screen_name":"facebook","location":"Menlo Park, California","description":"Give people the power to build community and bring the world closer together.","url":"http:\/\/t.co\/7bZ2KCQJ2k","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/7bZ2KCQJ2k","expanded_url":"http:\/\/facebook.com","display_url":"facebook.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":14034332,"friends_count":92,"listed_count":43686,"created_at":"Tue Mar 27 07:29:25 +0000 2007","favourites_count":430,"utc_offset":-28800,"time_zone":"Pacific Time (US & Canada)","geo_enabled":false,"verified":true,"statuses_count":8481,"lang":"en","status":{"created_at":"Fri Dec 15 22:36:04 +0000 2017","id":941799043407269888,"id_str":"941799043407269888","text":"@adambungle Hi Adam. If there's already a Facebook account associated with your email address, please fill out this\u2026 https:\/\/t.co\/KJEGff3Sp8","truncated":true,"entities":{"hashtags":[],"symbols":[],"user_mentions":[{"screen_name":"adambungle","name":"Adam Forster","id":212532742,"id_str":"212532742","indices":[0,11]}],"urls":[{"url":"https:\/\/t.co\/KJEGff3Sp8","expanded_url":"https:\/\/twitter.com\/i\/web\/status\/941799043407269888","display_url":"twitter.com\/i\/web\/status\/9\u2026","indices":[117,140]}]},"source":"\u003ca href=\"http:\/\/www.spredfast.com\" rel=\"nofollow\"\u003eSpredfast app\u003c\/a\u003e","in_reply_to_status_id":941231370600435712,"in_reply_to_status_id_str":"941231370600435712","in_reply_to_user_id":212532742,"in_reply_to_user_id_str":"212532742","in_reply_to_screen_name":"adambungle","geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":1,"favorite_count":4,"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},"contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"3C5A99","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/4699594\/quail_air_background.png","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/4699594\/quail_air_background.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/3513354941\/24aaffa670e634a7da9a087bfa83abe6_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/3513354941\/24aaffa670e634a7da9a087bfa83abe6_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/2425151\/1506715336","profile_link_color":"3C5A99","profile_sidebar_border_color":"DEDEDE","profile_sidebar_fill_color":"FFFFFF","profile_text_color":"000000","profile_use_background_image":true,"has_extended_profile":false,"default_profile":false,"default_profile_image":false,"following":true,"follow_request_sent":false,"notifications":false,"muting":false,"translator_type":"regular"}

0 commit comments

Comments
 (0)