tweepy.git
3 years agoLog by default in StreamListener methods
Harmon [Sun, 24 Jan 2021 13:27:46 +0000 (07:27 -0600)]
Log by default in StreamListener methods

3 years agoReturn thread when using threaded Stream.filter and Stream.sample
Harmon [Sat, 23 Jan 2021 20:23:48 +0000 (14:23 -0600)]
Return thread when using threaded Stream.filter and Stream.sample

3 years agoOptimize Stream.filter
Harmon [Sat, 23 Jan 2021 20:21:04 +0000 (14:21 -0600)]
Optimize Stream.filter

3 years agoImprove Stream.filter order and formatting
Harmon [Sat, 23 Jan 2021 20:10:39 +0000 (14:10 -0600)]
Improve Stream.filter order and formatting

3 years agoChange Stream.filter to use keyword-only arguments
Harmon [Sat, 23 Jan 2021 19:58:56 +0000 (13:58 -0600)]
Change Stream.filter to use keyword-only arguments

3 years agoChange Stream.sample to use keyword-only arguments
Harmon [Sat, 23 Jan 2021 19:54:24 +0000 (13:54 -0600)]
Change Stream.sample to use keyword-only arguments

3 years agoImprove order and formatting in Stream.sample
Harmon [Sat, 23 Jan 2021 19:53:26 +0000 (13:53 -0600)]
Improve order and formatting in Stream.sample

3 years agoChange Stream._thread to thread
Harmon [Sat, 23 Jan 2021 19:51:06 +0000 (13:51 -0600)]
Change Stream._thread to thread

3 years agoChange Stream._start to _threaded_connect
Harmon [Sat, 23 Jan 2021 19:48:01 +0000 (13:48 -0600)]
Change Stream._start to _threaded_connect

3 years agoSet Stream.running in Stream._connect instead of Stream._start
Harmon [Sat, 23 Jan 2021 19:40:32 +0000 (13:40 -0600)]
Set Stream.running in Stream._connect instead of Stream._start

3 years agoRename Stream._run to _connect
Harmon [Sat, 23 Jan 2021 19:39:41 +0000 (13:39 -0600)]
Rename Stream._run to _connect

3 years agoDefine Stream initialization keyword-only arguments explicitly
Harmon [Sat, 23 Jan 2021 19:33:41 +0000 (13:33 -0600)]
Define Stream initialization keyword-only arguments explicitly

3 years agoImprove Stream initialization order and formatting
Harmon [Sat, 23 Jan 2021 19:32:09 +0000 (13:32 -0600)]
Improve Stream initialization order and formatting

3 years agoName Thread in Stream
Harmon [Sat, 23 Jan 2021 19:22:08 +0000 (13:22 -0600)]
Name Thread in Stream

3 years agoRename Stream.retry_count to max_retries
Harmon [Sat, 23 Jan 2021 19:17:52 +0000 (13:17 -0600)]
Rename Stream.retry_count to max_retries

3 years agoRemove STREAM_VERSION
Harmon [Sat, 23 Jan 2021 17:23:31 +0000 (11:23 -0600)]
Remove STREAM_VERSION

3 years agoImprove order of Stream methods
Harmon [Sat, 23 Jan 2021 17:22:22 +0000 (11:22 -0600)]
Improve order of Stream methods

3 years agoRemove Stream._read_loop
Harmon [Sat, 23 Jan 2021 17:18:44 +0000 (11:18 -0600)]
Remove Stream._read_loop

3 years agoDefault Stream.retry_count to infinity
Harmon [Sat, 23 Jan 2021 17:13:27 +0000 (11:13 -0600)]
Default Stream.retry_count to infinity

3 years agoRemove unnecessary trailing slash from Documentation URL in setup.py
Harmon [Sat, 23 Jan 2021 17:09:29 +0000 (11:09 -0600)]
Remove unnecessary trailing slash from Documentation URL in setup.py

3 years agoRemove requests socks extra from setup.py install_requires
Harmon [Sat, 23 Jan 2021 17:06:51 +0000 (11:06 -0600)]
Remove requests socks extra from setup.py install_requires

Add socks extra requiring requests socks extra

3 years agoRemove Stream.timeout
Harmon [Sat, 23 Jan 2021 16:48:37 +0000 (10:48 -0600)]
Remove Stream.timeout

Use 90 seconds as the read timeout, per https://developer.twitter.com/en/docs/twitter-api/v1/tweets/filter-realtime/guides/connecting.
Default to using the same 90 seconds for connect timeout.

3 years agoReplace Stream.auth with parameters and attributes for each credential
Harmon [Sat, 23 Jan 2021 16:32:41 +0000 (10:32 -0600)]
Replace Stream.auth with parameters and attributes for each credential

Replace Stream.auth with Stream.consumer_key, Stream.consumer_secret, Stream.access_token, Stream.access_token_secret

3 years agoImprove variable name in Stream._run
Harmon [Sat, 23 Jan 2021 16:03:30 +0000 (10:03 -0600)]
Improve variable name in Stream._run

error_counter -> error_count

3 years agoRemove old and superfluous comments in Stream._run
Harmon [Sat, 23 Jan 2021 16:02:43 +0000 (10:02 -0600)]
Remove old and superfluous comments in Stream._run

3 years agoRemove Stream parameters and attributes for reconnect wait times
Harmon [Sat, 23 Jan 2021 15:56:40 +0000 (09:56 -0600)]
Remove Stream parameters and attributes for reconnect wait times

Remove Stream.retry_time_start, Stream.retry_420_start, Stream.retry_time_cap, Stream.snooze_time_step, Stream.snooze_time_cap, Stream.retry_time, Stream.snooze_time

3 years agoRemove Stream.url
Harmon [Sat, 23 Jan 2021 13:56:26 +0000 (07:56 -0600)]
Remove Stream.url

Pass endpoint to Stream._start / Stream._run

3 years agoMake Stream._start threaded parameter keyword-only argument
Harmon [Sat, 23 Jan 2021 13:55:13 +0000 (07:55 -0600)]
Make Stream._start threaded parameter keyword-only argument

3 years agoReplace Stream proxies parameter with proxy
Harmon [Sat, 23 Jan 2021 13:42:59 +0000 (07:42 -0600)]
Replace Stream proxies parameter with proxy

Resolves #1272

3 years agoRemove Python 3.5 from tox configuration
Harmon [Sat, 23 Jan 2021 13:18:04 +0000 (07:18 -0600)]
Remove Python 3.5 from tox configuration

3 years agoClose requests Session at the end of Stream._run
Harmon [Sat, 23 Jan 2021 00:18:25 +0000 (18:18 -0600)]
Close requests Session at the end of Stream._run

3 years agoRemove Stream.new_session
Harmon [Fri, 22 Jan 2021 23:53:55 +0000 (17:53 -0600)]
Remove Stream.new_session

Stop unnecessarily creating a new requests Session at the end of each call to Stream._run

3 years agoAllow requests Session to determine Content-Type header in Stream.filter
Harmon [Fri, 22 Jan 2021 23:35:58 +0000 (17:35 -0600)]
Allow requests Session to determine Content-Type header in Stream.filter

3 years agoRemove Stream.host
Harmon [Fri, 22 Jan 2021 23:33:37 +0000 (17:33 -0600)]
Remove Stream.host

3 years agoRemove Stream.headers
Harmon [Fri, 22 Jan 2021 23:32:39 +0000 (17:32 -0600)]
Remove Stream.headers

3 years agoPass params as kwarg to Stream._start and Stream._run in Stream.sample
Harmon [Fri, 22 Jan 2021 21:11:02 +0000 (15:11 -0600)]
Pass params as kwarg to Stream._start and Stream._run in Stream.sample

Instead of setting requests Session.params

3 years agoUse context manager for requests.Response in Stream
Harmon [Fri, 22 Jan 2021 21:00:19 +0000 (15:00 -0600)]
Use context manager for requests.Response in Stream

Improve formatting of requests Session.request call

3 years agoRemove Stream.filter encoding parameter
Harmon [Fri, 22 Jan 2021 20:48:10 +0000 (14:48 -0600)]
Remove Stream.filter encoding parameter

3 years agoPass daemon directly when initializing Thread in Stream
Harmon [Fri, 22 Jan 2021 18:53:12 +0000 (12:53 -0600)]
Pass daemon directly when initializing Thread in Stream

3 years agoDefault Stream._start threaded parameter to False
Harmon [Fri, 22 Jan 2021 18:50:16 +0000 (12:50 -0600)]
Default Stream._start threaded parameter to False

Pass threaded as kwarg to Stream._start in Stream.filter and Stream.sample

3 years agoRename is_async Stream.filter and Stream.sample parameters to threaded
Harmon [Fri, 22 Jan 2021 18:39:48 +0000 (12:39 -0600)]
Rename is_async Stream.filter and Stream.sample parameters to threaded

3 years agoRemove Stream.body
Harmon [Fri, 22 Jan 2021 18:33:32 +0000 (12:33 -0600)]
Remove Stream.body

Pass body to Stream._start / Stream._run

3 years agoUse requests Response.iter_lines in Stream
Harmon [Fri, 22 Jan 2021 16:52:57 +0000 (10:52 -0600)]
Use requests Response.iter_lines in Stream

Remove and replace ReadBuffer

The on_data method of the stream listener is now passed the raw data from Stream in bytes form.

The previous regex check for the charset directive/parameter in the Content-Type HTTP header was unnecessary anyway, as it's not included in the response for streams (anymore?).

This reduces the overhead for each line of data if the raw data doesn't need to be decoded to be processed, but passes on the burden of decoding the raw data if the default StreamListener.on_data is not being used.

The default StreamListener.on_data implementation should still be fine, as json.loads can process bytes since Python 3.6 and accepts UTF-8 encoding, which it should still be safe to assume is used as the encoding for the raw data, as before, when the unnecessary regex check would fail.

This Stream._read_loop implementation also allows the stream to disconnect when any line of data is received, including keep-alive signals, which resolves #773 and resolves #897.

3 years agoRemove dependence on string length delimitation in Stream
Harmon [Fri, 22 Jan 2021 14:42:59 +0000 (08:42 -0600)]
Remove dependence on string length delimitation in Stream

Simply read the entire line instead of passing "length" as the delimited parameter for the stream and reading the length of the string given by each delimiter

3 years agoRestrict requests and requests_oauthlib major version requirements
Harmon [Thu, 21 Jan 2021 10:28:00 +0000 (04:28 -0600)]
Restrict requests and requests_oauthlib major version requirements

3 years agoUpdate requests_oauthlib dependency requirement to >= 1.0.0
Harmon [Thu, 21 Jan 2021 10:25:32 +0000 (04:25 -0600)]
Update requests_oauthlib dependency requirement to >= 1.0.0

3 years agoRename StreamListener.on_error to on_request_error
Harmon [Thu, 21 Jan 2021 01:41:34 +0000 (19:41 -0600)]
Rename StreamListener.on_error to on_request_error

3 years agoRename StreamListener.on_timeout to on_connection_error
Harmon [Tue, 19 Jan 2021 09:41:55 +0000 (03:41 -0600)]
Rename StreamListener.on_timeout to on_connection_error

3 years agoHandle connection errors when streaming
Harmon [Tue, 19 Jan 2021 09:40:05 +0000 (03:40 -0600)]
Handle connection errors when streaming

Handle requests.ConnectionError, urllib3.exceptions.ReadTimeoutError, urllib3.exceptions.ProtocolError

Handling urllib3.exceptions.ProtocolError should handle the reraised/wrapped http.client.IncompleteRead connection error that can occur and resolves #237 and resolves #448

Handling urllib3.exceptions.ReadTimeoutError resolves #750

Handling urllib3.exceptions.ProtocolError should also handle the reraised/wrapped ConnectionResetError that can occur and resolves #1416

3 years agoImplement API.retweet and API.unretweet test
Harmon [Fri, 15 Jan 2021 06:43:27 +0000 (00:43 -0600)]
Implement API.retweet and API.unretweet test

3 years agoTreat all 2xx HTTP status codes as successful responses
Harmon [Thu, 14 Jan 2021 19:24:53 +0000 (13:24 -0600)]
Treat all 2xx HTTP status codes as successful responses

3 years agoRemove API.search_host, API.search_root, and APIMethod.search_api
Harmon [Thu, 14 Jan 2021 03:40:55 +0000 (21:40 -0600)]
Remove API.search_host, API.search_root, and APIMethod.search_api

3 years agoImprove formatting in API tests
Harmon [Tue, 12 Jan 2021 18:14:56 +0000 (12:14 -0600)]
Improve formatting in API tests

3 years agoImprove formatting in rate limit tests
Harmon [Tue, 12 Jan 2021 18:13:15 +0000 (12:13 -0600)]
Improve formatting in rate limit tests

3 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

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

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

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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 years agoRemove API._send_direct_message
Harmon [Sun, 10 Jan 2021 02:10:55 +0000 (20:10 -0600)]
Remove API._send_direct_message

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

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

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

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

3 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

3 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

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

3 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

3 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

3 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

3 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

3 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>
3 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

3 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>
3 years agoImprove formatting in streaming.py
Harmon [Wed, 30 Dec 2020 09:46:24 +0000 (03:46 -0600)]
Improve formatting in streaming.py

3 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

3 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

3 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__