tweepy.git
4 years agoSpecify file parameter for API.update_profile_banner explicitly
Harmon [Thu, 14 Jan 2021 11:19:19 +0000 (05:19 -0600)]
Specify file parameter for API.update_profile_banner explicitly

4 years agoImprove API.update_profile_image file uploading
Harmon [Thu, 14 Jan 2021 11:13:25 +0000 (05:13 -0600)]
Improve API.update_profile_image file uploading

Use files parameter of requests Session.request
Allow Twitter's API to respond with "Image validation failed with errors: Image size must be <= 2.0 MiB." and "media type unrecognized." errors instead of checking for file size and type prior to upload.

4 years agoRename API.update_profile_image file_ parameter to file
Harmon [Thu, 14 Jan 2021 10:59:51 +0000 (04:59 -0600)]
Rename API.update_profile_image file_ parameter to file

4 years agoRemove unnecessary allowed_param argument for API.create_media_metadata
Harmon [Wed, 13 Jan 2021 20:12:07 +0000 (14:12 -0600)]
Remove unnecessary allowed_param argument for API.create_media_metadata

4 years agoRemove unnecessary allowed_param arguments for media upload methods
Harmon [Wed, 13 Jan 2021 20:09:12 +0000 (14:09 -0600)]
Remove unnecessary allowed_param arguments for media upload methods

API.simple_upload, API.chunked_upload_init, API.chunked_upload_append, API.chunked_upload_finalize

4 years agoRemove payload_type and parser arguments for API.chunked_upload_append
Harmon [Wed, 13 Jan 2021 19:54:17 +0000 (13:54 -0600)]
Remove payload_type and parser arguments for API.chunked_upload_append

4 years agoImprove comments in API.chunked_upload
Harmon [Wed, 13 Jan 2021 19:49:41 +0000 (13:49 -0600)]
Improve comments in API.chunked_upload

4 years agoRemove image types constant
Harmon [Wed, 13 Jan 2021 19:38:48 +0000 (13:38 -0600)]
Remove image types constant

Only used once in API._pack_image

4 years agoAdd media_category parameter to API.chunked_upload
Harmon [Wed, 13 Jan 2021 19:34:53 +0000 (13:34 -0600)]
Add media_category parameter to API.chunked_upload

Replace is_direct_message parameter
Remove API._get_media_category

This allows for the media_category parameter to be more clearly set and set with values outside of those that were previously hardcoded, e.g. amplify_video.

4 years agoAdd media_category parameter to API.simple_upload
Harmon [Wed, 13 Jan 2021 19:27:59 +0000 (13:27 -0600)]
Add media_category parameter to API.simple_upload

4 years agoUse initial file pointer location in API.chunked_upload
Harmon [Wed, 13 Jan 2021 17:45:59 +0000 (11:45 -0600)]
Use initial file pointer location in API.chunked_upload

Rather than resetting to the beginning of the passed file

4 years agoReplace file size check in API.media_upload with chunked parameter
Harmon [Wed, 13 Jan 2021 17:36:11 +0000 (11:36 -0600)]
Replace file size check in API.media_upload with chunked parameter

The simple upload endpoint seems to accept media file sizes much larger than documented, as long as the size after Twitter's API processes the media is below 5 MiB (e.g. through compression, stripping whitespace, etc.). This makes any file size checks prior to uploading to the API potentially overly restrictive.

Regardless of this, MAX_UPLOAD_SIZE_STANDARD was already lower than necessary anyway, as the limit appears to be 5 MiB rather than 5 MB, as the error message when using chunked upload for a file larger than 5 MiB, "File size exceeds 5242880 bytes.", indicates.

The simple upload endpoint seems to consistently respond with a 413 Payload Too Large HTTP response status code when the uploaded file is too large, even after being processed, which should make it fairly apparent that the file is too large.

Most GIFs should be under 5 MiB, but for larger GIFs that the simple upload endpoint will error for, using the chunked parameter will be necessary. Adding this parameter also allows chunked upload of images less than 5 MiB as desired.

4 years agoRemove file type check in API.media_upload
Harmon [Wed, 13 Jan 2021 16:18:07 +0000 (10:18 -0600)]
Remove file type check in API.media_upload

The error message Twitter's API responds with when the file type is unsupported, "media type unrecognized.", is fairly self-explanatory.
Allowing Twitter's API to handle the media type check and avoiding hardcoding supported types also removes the need to update them in the future if they change.

4 years agoHandle upload chunk size in bytes
Harmon [Wed, 13 Jan 2021 03:28:29 +0000 (21:28 -0600)]
Handle upload chunk size in bytes

4 years agoRemove default and max chunk size constants
Harmon [Wed, 13 Jan 2021 03:15:30 +0000 (21:15 -0600)]
Remove default and max chunk size constants

Only used once each in API.chunked_upload

4 years agoBase minimum chunk size for uploads on actual file size
Harmon [Wed, 13 Jan 2021 03:07:15 +0000 (21:07 -0600)]
Base minimum chunk size for uploads on actual file size

MIN_CHUNKSIZE was too small for possible video sizes regardless

4 years agoRemove max file size checks for chunked uploads
Harmon [Tue, 12 Jan 2021 21:35:42 +0000 (15:35 -0600)]
Remove max file size checks for chunked uploads

The error messages Twitter's API responds with when the file size is too large, "File size exceeds 15728640 bytes." for GIFs and "File size exceeds 536870912 bytes." for videos, are fairly self-explanatory.
This check was incorrect for videos anyway, which seem to have a size restriction of 512 MiB, not 15 MB.
https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/uploading-media/media-best-practices
https://twittercommunity.com/t/conflicting-documented-size-restrictions-for-video-uploading-via-api/148201
Allowing Twitter's API to handle the size restrictions and avoiding hardcoding them also removes the need to update them in the future if they change.

4 years agoFix logic in determining number of segments in API.chunked_upload
Harmon [Tue, 12 Jan 2021 20:33:07 +0000 (14:33 -0600)]
Fix logic in determining number of segments in API.chunked_upload

4 years agoOptimize determination of number of segments in API.chunked_upload
Harmon [Tue, 12 Jan 2021 20:16:27 +0000 (14:16 -0600)]
Optimize determination of number of segments in API.chunked_upload

4 years agoReuse previously determined file size in API.chunked_upload
Harmon [Tue, 12 Jan 2021 20:01:13 +0000 (14:01 -0600)]
Reuse previously determined file size in API.chunked_upload

Fixes file size determination with file parameter

4 years agoSimplify API.chunked_upload
Harmon [Tue, 12 Jan 2021 19:47:22 +0000 (13:47 -0600)]
Simplify API.chunked_upload

4 years agoImprove variable names in API.chunked_upload
Harmon [Tue, 12 Jan 2021 19:41:31 +0000 (13:41 -0600)]
Improve variable names in API.chunked_upload

5 years agoHandle additional_owners parameter in API.chunked_upload_init
Harmon [Tue, 12 Jan 2021 18:22:42 +0000 (12:22 -0600)]
Handle additional_owners parameter in API.chunked_upload_init

5 years agoRename API.simple_upload and API.chunked_upload f parameters to file
Harmon [Tue, 12 Jan 2021 17:50:15 +0000 (11:50 -0600)]
Rename API.simple_upload and API.chunked_upload f parameters to file

5 years agoRename variable from f to file in API.media_upload
Harmon [Tue, 12 Jan 2021 17:49:21 +0000 (11:49 -0600)]
Rename variable from f to file in API.media_upload

Specify as parameter explicitly

5 years agoSpecify API.chunked_upload parameters explicitly
Harmon [Tue, 12 Jan 2021 17:40:28 +0000 (11:40 -0600)]
Specify API.chunked_upload parameters explicitly

5 years agoFix API.chunked_upload file object parameter name
Harmon [Tue, 12 Jan 2021 17:30:19 +0000 (11:30 -0600)]
Fix API.chunked_upload file object parameter name

5 years agoRemove urllib.parse.urlencode import
Harmon [Tue, 12 Jan 2021 17:15:11 +0000 (11:15 -0600)]
Remove urllib.parse.urlencode import

5 years agoRefactor API.chunked_upload
Harmon [Tue, 12 Jan 2021 17:01:43 +0000 (11:01 -0600)]
Refactor API.chunked_upload

Add API.chunked_upload_init, API.chunked_upload_append, API.chunked_upload_finalize
Remove API._chunk_media
Use requests Session.request data and files parameters

5 years agoRename API.image_upload to API.simple_upload
Harmon [Tue, 12 Jan 2021 15:21:40 +0000 (09:21 -0600)]
Rename API.image_upload to API.simple_upload

5 years agoRename API.upload_chunked to API.chunked_upload
Harmon [Tue, 12 Jan 2021 15:19:52 +0000 (09:19 -0600)]
Rename API.upload_chunked to API.chunked_upload

5 years agoUpdate cassettes for API.media_upload tests with GIF and PNG
Harmon [Tue, 12 Jan 2021 15:14:45 +0000 (09:14 -0600)]
Update cassettes for API.media_upload tests with GIF and PNG

5 years agoUse files parameter of requests Session.request for API.image_upload
Harmon [Tue, 12 Jan 2021 15:00:54 +0000 (09:00 -0600)]
Use files parameter of requests Session.request for API.image_upload

5 years agoFix file parameter size determination in API.media_upload
Harmon [Tue, 12 Jan 2021 14:52:59 +0000 (08:52 -0600)]
Fix file parameter size determination in API.media_upload

5 years agoImprove clarity of API.media_upload
Harmon [Tue, 12 Jan 2021 13:35:48 +0000 (07:35 -0600)]
Improve clarity of API.media_upload

5 years agoReplace str.format usage with f-strings
Harmon [Tue, 12 Jan 2021 12:51:09 +0000 (06:51 -0600)]
Replace str.format usage with f-strings

5 years agoReplace old C-style string formatting/interpolation with f-strings
Harmon [Tue, 12 Jan 2021 12:48:52 +0000 (06:48 -0600)]
Replace old C-style string formatting/interpolation with f-strings

5 years agoMerge branch 'master' into video-upload
Harmon [Tue, 12 Jan 2021 12:44:46 +0000 (06:44 -0600)]
Merge branch 'master' into video-upload

5 years agoSet COVERALLS_SERVICE_NAME to github in GitHub Actions Test workflow
Harmon [Tue, 12 Jan 2021 12:31:22 +0000 (06:31 -0600)]
Set COVERALLS_SERVICE_NAME to github in GitHub Actions Test workflow

https://github.com/coveralls-clients/coveralls-python/issues/240
https://github.com/coveralls-clients/coveralls-python/pull/249

5 years agoReplace os.error with OSError
Harmon [Tue, 12 Jan 2021 12:04:09 +0000 (06:04 -0600)]
Replace os.error with OSError

5 years agoRemove API._remove_list_members
Harmon [Mon, 11 Jan 2021 18:55:14 +0000 (12:55 -0600)]
Remove API._remove_list_members

5 years agoRemove API._add_list_members
Harmon [Mon, 11 Jan 2021 18:52:08 +0000 (12:52 -0600)]
Remove API._add_list_members

5 years agoRemove API._lookup_friendships
Harmon [Mon, 11 Jan 2021 18:30:41 +0000 (12:30 -0600)]
Remove API._lookup_friendships

5 years agoAllow sending Call-To-Action buttons with Direct Messages
Harmon [Mon, 11 Jan 2021 16:58:53 +0000 (10:58 -0600)]
Allow sending Call-To-Action buttons with Direct Messages

In API.send_direct_message
Resolves #1311

5 years agoImprove clarity of and optimize API.send_direct_message
Harmon [Mon, 11 Jan 2021 16:40:01 +0000 (10:40 -0600)]
Improve clarity of and optimize API.send_direct_message

5 years agoAllow sending Quick Reply Options with Direct Messages
Harmon [Mon, 11 Jan 2021 14:52:24 +0000 (08:52 -0600)]
Allow sending Quick Reply Options with Direct Messages

Replace API.send_direct_message quick_reply_type parameter with quick_reply_options
Resolves #1280

5 years agoMerge pull request #1487 from tweepy/python-3.5-support-removal
Harmon [Mon, 11 Jan 2021 13:27:27 +0000 (07:27 -0600)]
Merge pull request #1487 from tweepy/python-3.5-support-removal

Drop support for Python 3.5

5 years agoImprove formatting in Status and User methods
Harmon [Sun, 10 Jan 2021 15:34:48 +0000 (09:34 -0600)]
Improve formatting in Status and User methods

5 years agoMerge pull request #1282 from okomestudio/ts/lists_ownerships
Harmon [Sun, 10 Jan 2021 03:31:16 +0000 (21:31 -0600)]
Merge pull request #1282 from okomestudio/ts/lists_ownerships

Implement lists/ownerships

5 years agoUpdate cassette for API.lists_ownerships test
Harmon [Sun, 10 Jan 2021 03:25:31 +0000 (21:25 -0600)]
Update cassette for API.lists_ownerships test

5 years agoMerge branch 'master' into ts/lists_ownerships
Harmon [Sun, 10 Jan 2021 03:14:45 +0000 (21:14 -0600)]
Merge branch 'master' into ts/lists_ownerships

5 years agoUpdate tweepy/models.py
Taro Sato [Sun, 10 Jan 2021 02:40:55 +0000 (18:40 -0800)]
Update tweepy/models.py

Co-authored-by: Harmon <Harmon758@gmail.com>
5 years agoUpdate tweepy/api.py
Taro Sato [Sun, 10 Jan 2021 02:40:48 +0000 (18:40 -0800)]
Update tweepy/api.py

Co-authored-by: Harmon <Harmon758@gmail.com>
5 years agoUpdate docs/api.rst
Taro Sato [Sun, 10 Jan 2021 02:40:41 +0000 (18:40 -0800)]
Update docs/api.rst

Co-authored-by: Harmon <Harmon758@gmail.com>
5 years agoUpdate tweepy/api.py
Taro Sato [Sun, 10 Jan 2021 02:40:33 +0000 (18:40 -0800)]
Update tweepy/api.py

Co-authored-by: Harmon <Harmon758@gmail.com>
5 years agoUpdate docs/api.rst
Taro Sato [Sun, 10 Jan 2021 02:40:25 +0000 (18:40 -0800)]
Update docs/api.rst

Co-authored-by: Harmon <Harmon758@gmail.com>
5 years agoUpdate docs/api.rst
Taro Sato [Sun, 10 Jan 2021 02:40:15 +0000 (18:40 -0800)]
Update docs/api.rst

Co-authored-by: Harmon <Harmon758@gmail.com>
5 years agoRemove API._send_direct_message
Harmon [Sun, 10 Jan 2021 02:10:55 +0000 (20:10 -0600)]
Remove API._send_direct_message

5 years agoRemove unnecessary allowed_param argument in API._send_direct_message
Harmon [Sun, 10 Jan 2021 02:08:34 +0000 (20:08 -0600)]
Remove unnecessary allowed_param argument in API._send_direct_message

5 years agoMerge branch 'master' into python-3.5-support-removal
Harmon [Fri, 8 Jan 2021 09:34:53 +0000 (03:34 -0600)]
Merge branch 'master' into python-3.5-support-removal

5 years agoReduce extra sleep time for rate limit handling in APIMethod.execute
Harmon [Wed, 6 Jan 2021 20:15:09 +0000 (14:15 -0600)]
Reduce extra sleep time for rate limit handling in APIMethod.execute

Resolves #1049

5 years agoImprove clarity of rate limit handling in APIMethod.execute
Harmon [Wed, 6 Jan 2021 19:59:46 +0000 (13:59 -0600)]
Improve clarity of rate limit handling in APIMethod.execute

Also improve comment capitalization consistency and remove unnecessary comments

5 years agoOptimize HTTP status code checks and retry handling in APIMethod.execute
Harmon [Wed, 6 Jan 2021 02:00:50 +0000 (20:00 -0600)]
Optimize HTTP status code checks and retry handling in APIMethod.execute

Also improve formatting

5 years agoImprove APIMethod.execute check for 420 and 429 HTTP status codes
Harmon [Wed, 6 Jan 2021 01:19:33 +0000 (19:19 -0600)]
Improve APIMethod.execute check for 420 and 429 HTTP status codes

Also improve formatting and consistency in comment capitalization

5 years agoRemove explicit handling of requests.ReadTimeout in Stream
Harmon [Tue, 5 Jan 2021 08:54:51 +0000 (02:54 -0600)]
Remove explicit handling of requests.ReadTimeout in Stream

requests.ReadTimeout subclasses requests.Timeout, so this shouldn't be necessary

5 years agoHandle requests.ReadTimeout in Stream
Harmon [Tue, 5 Jan 2021 08:15:29 +0000 (02:15 -0600)]
Handle requests.ReadTimeout in Stream

Resolves #750

5 years agoSimplify requests imports in streaming.py
Harmon [Tue, 5 Jan 2021 08:08:37 +0000 (02:08 -0600)]
Simplify requests imports in streaming.py

5 years agoRename StreamListener.keep_alive to StreamListener.on_keep_alive
Harmon [Mon, 4 Jan 2021 10:11:22 +0000 (04:11 -0600)]
Rename StreamListener.keep_alive to StreamListener.on_keep_alive

To be consistent with other StreamListener methods

5 years agoImprove variable name in Stream
Harmon [Mon, 4 Jan 2021 09:42:09 +0000 (03:42 -0600)]
Improve variable name in Stream

5 years agoRemove Stream._data method
Harmon [Mon, 4 Jan 2021 09:35:38 +0000 (03:35 -0600)]
Remove Stream._data method

5 years agoRemove unused variable in Stream
Harmon [Mon, 4 Jan 2021 09:29:45 +0000 (03:29 -0600)]
Remove unused variable in Stream

5 years agoRemove parse_a_href and parse_html_value functions
Harmon [Sun, 3 Jan 2021 03:27:58 +0000 (21:27 -0600)]
Remove parse_a_href and parse_html_value functions

5 years agoReplace convert_to_utf8_str function with str cast
Harmon [Sun, 3 Jan 2021 02:10:16 +0000 (20:10 -0600)]
Replace convert_to_utf8_str function with str cast

5 years agoOptimize list_to_csv function
Harmon [Sun, 3 Jan 2021 02:03:38 +0000 (20:03 -0600)]
Optimize list_to_csv function

5 years agoReplace parse_datetime function with email.utils.parsedate_to_datetime
Harmon [Sun, 3 Jan 2021 01:57:43 +0000 (19:57 -0600)]
Replace parse_datetime function with email.utils.parsedate_to_datetime

This causes the datetime objects for created_at attributes to be aware

5 years agoUpdate copyright years to include 2021
Harmon [Sat, 2 Jan 2021 14:03:01 +0000 (08:03 -0600)]
Update copyright years to include 2021

5 years agoAdd and use mixins for Status and User
Harmon [Thu, 31 Dec 2020 04:27:27 +0000 (22:27 -0600)]
Add and use mixins for Status and User

5 years agoMerge pull request #1306 from mef51/patch-1
Harmon [Thu, 31 Dec 2020 03:25:46 +0000 (21:25 -0600)]
Merge pull request #1306 from mef51/patch-1

make User object hashable to allow use with sets

5 years agohash == id
mohammed chamma [Thu, 31 Dec 2020 03:12:24 +0000 (22:12 -0500)]
hash == id

Co-authored-by: Harmon <Harmon758@gmail.com>
5 years agoMerge branch 'master' into patch-1
mohammed chamma [Wed, 30 Dec 2020 23:45:08 +0000 (18:45 -0500)]
Merge branch 'master' into patch-1

5 years agouse id as hash since its an integer
mohammed chamma [Wed, 30 Dec 2020 23:39:56 +0000 (18:39 -0500)]
use id as hash since its an integer

Co-authored-by: Harmon <Harmon758@gmail.com>
5 years agoImprove formatting in streaming.py
Harmon [Wed, 30 Dec 2020 09:46:24 +0000 (03:46 -0600)]
Improve formatting in streaming.py

5 years agoCheck consumer key and secret type when initializing OAuthHandler
Harmon [Wed, 30 Dec 2020 06:29:21 +0000 (00:29 -0600)]
Check consumer key and secret type when initializing OAuthHandler

Resolves #1489

5 years agoRemove unnecessary ASCII encoding of credentials in OAuthHandler
Harmon [Wed, 30 Dec 2020 06:00:12 +0000 (00:00 -0600)]
Remove unnecessary ASCII encoding of credentials in OAuthHandler

5 years agoRemove Status.__ne__ and User.__ne__
Harmon [Wed, 30 Dec 2020 04:29:38 +0000 (22:29 -0600)]
Remove Status.__ne__ and User.__ne__

5 years agoImprove exception handling in Stream
Harmon [Tue, 29 Dec 2020 22:49:29 +0000 (16:49 -0600)]
Improve exception handling in Stream

5 years agoRemove StreamListener.on_event
Harmon [Tue, 29 Dec 2020 12:18:10 +0000 (06:18 -0600)]
Remove StreamListener.on_event

5 years agoSimplify StreamListener.on_data
Harmon [Tue, 29 Dec 2020 09:22:36 +0000 (03:22 -0600)]
Simplify StreamListener.on_data

5 years agoMerge pull request #1484 from dplefevre/doc_fix
Harmon [Tue, 29 Dec 2020 08:45:43 +0000 (02:45 -0600)]
Merge pull request #1484 from dplefevre/doc_fix

Doc fix

5 years agoImprove formatting for documentation for include_rts parameter
Harmon [Tue, 29 Dec 2020 08:41:30 +0000 (02:41 -0600)]
Improve formatting for documentation for include_rts parameter

In documentation for API.user_timeline

5 years agoUpdate cassette for user_timeline test
Harmon [Tue, 29 Dec 2020 08:36:14 +0000 (02:36 -0600)]
Update cassette for user_timeline test

5 years agoUpdate user_timeline test
Harmon [Tue, 29 Dec 2020 08:35:43 +0000 (02:35 -0600)]
Update user_timeline test

5 years agoRemove Stream.api
Harmon [Tue, 29 Dec 2020 08:02:21 +0000 (02:02 -0600)]
Remove Stream.api

5 years agoSimplify Stream.disconnect
Harmon [Tue, 29 Dec 2020 07:34:32 +0000 (01:34 -0600)]
Simplify Stream.disconnect

5 years agoImprove inline comment formatting in Stream._read_loop
Harmon [Tue, 29 Dec 2020 07:30:29 +0000 (01:30 -0600)]
Improve inline comment formatting in Stream._read_loop

5 years agoAdd Python Versions badge to README
Harmon [Tue, 29 Dec 2020 03:50:32 +0000 (21:50 -0600)]
Add Python Versions badge to README

5 years agoRemove unnecessary URL parameter in Documentation Status badge in README
Harmon [Tue, 29 Dec 2020 03:39:42 +0000 (21:39 -0600)]
Remove unnecessary URL parameter in Documentation Status badge in README

5 years agoImprove PyPI Version badge in README
Harmon [Tue, 29 Dec 2020 03:38:43 +0000 (21:38 -0600)]
Improve PyPI Version badge in README

5 years agoAdd links to documentation and Twitter API documentation to README
Harmon [Tue, 29 Dec 2020 03:31:55 +0000 (21:31 -0600)]
Add links to documentation and Twitter API documentation to README

Also improve Discord server invite link text

5 years agoImprove Discord badge in README
Harmon [Tue, 29 Dec 2020 03:27:56 +0000 (21:27 -0600)]
Improve Discord badge in README