Skip to content

Commit

Permalink
Merge pull request #10 from iyanuashiri/feat/remove-unused-argument
Browse files Browse the repository at this point in the history
Feat/remove unused argument
  • Loading branch information
iyanuashiri authored Jan 10, 2023
2 parents 03869f4 + a665fca commit e41c62c
Show file tree
Hide file tree
Showing 9 changed files with 276 additions and 264 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "twitter_threader"
version = "1.5.0"
version = "1.5.1"
authors = [{name = "Iyanuoluwa Ajao", email = "[email protected]"}]
description = "Twitter Threader is a library to manage threads on Twitter. You can GET and POST threads on Twitter"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ flit==3.7.1
pytest==7.1.2
python-decouple==3.6
pytest-recording==0.12.1
tweepy==3.9.0
tweepy==4.12.1
146 changes: 35 additions & 111 deletions tests/cassettes/test_threader/test_connect_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,151 +2,75 @@ interactions:
- request:
body: null
headers:
Host:
- api.twitter.com
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- Python/3.10.6 Requests/2.28.1 Tweepy/4.12.1
method: GET
uri: https://api.twitter.com/1.1/account/verify_credentials.json
uri: https://api.twitter.com/1.1/account/settings.json
response:
body:
string: '{"id":1329690878261284865,"id_str":"1329690878261284865","name":"Too
Long; Read a Summary","screen_name":"SummarizerBot","location":"","description":"It
summarizes any type of information. Mention the bot as a reply to a shared
article or a long thread and it returns with the link of a summary.","url":null,"entities":{"description":{"urls":[]}},"protected":true,"followers_count":1,"friends_count":0,"listed_count":0,"created_at":"Fri
Nov 20 07:40:38 +0000 2020","favourites_count":0,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":68,"lang":null,"status":{"created_at":"Sat
Jan 16 23:47:16 +0000 2021","id":1350590472276897795,"id_str":"1350590472276897795","text":"@summarizer_bot
Read the summary you asked for on this link https:\/\/t.co\/gW1P6UaQDy below","truncated":false,"entities":{"hashtags":[],"symbols":[],"user_mentions":[{"screen_name":"summarizer_bot","name":"Summarizer
Bot","id":1329707506357194753,"id_str":"1329707506357194753","indices":[0,15]}],"urls":[{"url":"https:\/\/t.co\/gW1P6UaQDy","expanded_url":"https:\/\/summarizerbot.herokoapp.com\/blog\/12","display_url":"summarizerbot.herokoapp.com\/blog\/12","indices":[60,83]}]},"source":"\u003ca
href=\"https:\/\/help.twitter.com\/en\/using-twitter\/how-to-tweet#source-labels\"
rel=\"nofollow\"\u003esummarizer_bot\u003c\/a\u003e","in_reply_to_status_id":1350530561631285249,"in_reply_to_status_id_str":"1350530561631285249","in_reply_to_user_id":1329707506357194753,"in_reply_to_user_id_str":"1329707506357194753","in_reply_to_screen_name":"summarizer_bot","geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":0,"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},"contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"F5F8FA","profile_background_image_url":null,"profile_background_image_url_https":null,"profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1329691215877517312\/oz9NDnSc_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1329691215877517312\/oz9NDnSc_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/1329690878261284865\/1609242083","profile_link_color":"1DA1F2","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false,"translator_type":"none","withheld_in_countries":[],"suspended":false,"needs_phone_verification":false}'
string: !!binary |
H4sIAAAAAAAAAGyPUW4DMQhE7+LvnCCfvUIPgNhdskHF4GKcaBPl7rWlJl1F/UMzw/C4p+IWNAct
6XhCqXRIdXYiBcVM6Zg+W87ofCP/sEiHhHLFrUKrBOeIUtMxvPWtIcxmX0xQyKspCt8w2PSvWIgK
BI/eeyLFSXZnSZdfT5tITwd67JTHIa1k8L4mqGvDdaCSdr6F62wX8pGCaQPKyPKEfDezTdyncjal
V2MPFcENKmnl4AtBpoXx5aOIXfuvGs5TC3Nw+m5UoyN0Lz0TS65wcstdPtlQWNedCatbK/9GwlGr
4KiOrYzXdAA+fgAAAP//AwD732RRrgEAAA==
headers:
cache-control:
- no-cache, no-store, must-revalidate, pre-check=0, post-check=0
content-disposition:
- attachment; filename=json.json
content-encoding:
- gzip
content-length:
- '2738'
- '253'
content-type:
- application/json;charset=utf-8
date:
- Sat, 09 Jul 2022 15:50:14 GMT
- Tue, 10 Jan 2023 13:24:28 GMT
expires:
- Tue, 31 Mar 1981 05:00:00 GMT
last-modified:
- Sat, 09 Jul 2022 15:50:14 GMT
- Tue, 10 Jan 2023 13:24:28 GMT
perf:
- '7626143928'
pragma:
- no-cache
server:
- tsa_f
set-cookie:
- guest_id_marketing=v1%3A165738181422883243; Max-Age=63072000; Expires=Mon,
08 Jul 2024 15:50:14 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- guest_id_ads=v1%3A165738181422883243; Max-Age=63072000; Expires=Mon, 08 Jul
2024 15:50:14 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- personalization_id="v1_dn1EnUUraGOkfrm0fwf0Yg=="; Max-Age=63072000; Expires=Mon,
08 Jul 2024 15:50:14 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- guest_id_marketing=v1%3A167335706826408508; Max-Age=63072000; Expires=Thu,
09 Jan 2025 13:24:28 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- guest_id_ads=v1%3A167335706826408508; Max-Age=63072000; Expires=Thu, 09 Jan
2025 13:24:28 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- personalization_id="v1_CyKGqaHZX5MOnG2GaeSHLg=="; Max-Age=63072000; Expires=Thu,
09 Jan 2025 13:24:28 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- lang=en; Path=/
- guest_id=v1%3A165738181422883243; Max-Age=63072000; Expires=Mon, 08 Jul 2024
15:50:14 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- guest_id=v1%3A167335706826408508; Max-Age=63072000; Expires=Thu, 09 Jan 2025
13:24:28 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
status:
- 200 OK
strict-transport-security:
- max-age=631138519
x-access-level:
- read-write-directmessages
x-connection-hash:
- d0d7bd87038229633973981b03bd04a3f1d74380af454d9228c695e4766d358a
- 7d57ed4ab2d6ddfd1838bbd41911e9d135f60210923b8a6e8852e3c0c626737f
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-rate-limit-limit:
- '75'
x-rate-limit-remaining:
- '74'
x-rate-limit-reset:
- '1657382714'
x-response-time:
- '124'
- '103'
x-transaction:
- ce7e4ea0e62829a0
x-twitter-response-tags:
- BouncerExempt
- BouncerCompliant
x-xss-protection:
- '0'
status:
code: 200
message: OK
- request:
body: null
headers:
Host:
- api.twitter.com
method: GET
uri: https://api.twitter.com/1.1/users/show.json?screen_name=SummarizerBot
response:
body:
string: '{"id":1329690878261284865,"id_str":"1329690878261284865","name":"Too
Long; Read a Summary","screen_name":"SummarizerBot","location":"","profile_location":null,"description":"It
summarizes any type of information. Mention the bot as a reply to a shared
article or a long thread and it returns with the link of a summary.","url":null,"entities":{"description":{"urls":[]}},"protected":true,"followers_count":1,"friends_count":0,"listed_count":0,"created_at":"Fri
Nov 20 07:40:38 +0000 2020","favourites_count":0,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":68,"lang":null,"status":{"created_at":"Sat
Jan 16 23:47:16 +0000 2021","id":1350590472276897795,"id_str":"1350590472276897795","text":"@summarizer_bot
Read the summary you asked for on this link https:\/\/t.co\/gW1P6UaQDy below","truncated":false,"entities":{"hashtags":[],"symbols":[],"user_mentions":[{"screen_name":"summarizer_bot","name":"Summarizer
Bot","id":1329707506357194753,"id_str":"1329707506357194753","indices":[0,15]}],"urls":[{"url":"https:\/\/t.co\/gW1P6UaQDy","expanded_url":"https:\/\/summarizerbot.herokoapp.com\/blog\/12","display_url":"summarizerbot.herokoapp.com\/blog\/12","indices":[60,83]}]},"source":"\u003ca
href=\"https:\/\/help.twitter.com\/en\/using-twitter\/how-to-tweet#source-labels\"
rel=\"nofollow\"\u003esummarizer_bot\u003c\/a\u003e","in_reply_to_status_id":1350530561631285249,"in_reply_to_status_id_str":"1350530561631285249","in_reply_to_user_id":1329707506357194753,"in_reply_to_user_id_str":"1329707506357194753","in_reply_to_screen_name":"summarizer_bot","geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":0,"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"},"contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"F5F8FA","profile_background_image_url":null,"profile_background_image_url_https":null,"profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1329691215877517312\/oz9NDnSc_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1329691215877517312\/oz9NDnSc_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/1329690878261284865\/1609242083","profile_link_color":"1DA1F2","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false,"translator_type":"none","withheld_in_countries":[],"suspended":false,"needs_phone_verification":false}'
headers:
cache-control:
- no-cache, no-store, must-revalidate, pre-check=0, post-check=0
content-disposition:
- attachment; filename=json.json
content-length:
- '2762'
content-type:
- application/json;charset=utf-8
date:
- Sat, 09 Jul 2022 15:50:14 GMT
expires:
- Tue, 31 Mar 1981 05:00:00 GMT
last-modified:
- Sat, 09 Jul 2022 15:50:14 GMT
pragma:
- no-cache
server:
- tsa_f
set-cookie:
- guest_id_marketing=v1%3A165738181486436736; Max-Age=63072000; Expires=Mon,
08 Jul 2024 15:50:14 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- guest_id_ads=v1%3A165738181486436736; Max-Age=63072000; Expires=Mon, 08 Jul
2024 15:50:14 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- personalization_id="v1_v8PP7tP0i3t3f/Q9tVVtYg=="; Max-Age=63072000; Expires=Mon,
08 Jul 2024 15:50:14 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- lang=en; Path=/
- guest_id=v1%3A165738181486436736; Max-Age=63072000; Expires=Mon, 08 Jul 2024
15:50:14 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
status:
- 200 OK
strict-transport-security:
- max-age=631138519
x-access-level:
- read-write-directmessages
x-connection-hash:
- 815862aad939e3da1c7c8f1894b29972409d8f7115299d28d5443b612f2cf436
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-rate-limit-limit:
- '900'
x-rate-limit-remaining:
- '899'
x-rate-limit-reset:
- '1657382714'
x-response-time:
- '141'
x-transaction:
- 557860b6efed39fa
- 740bf6d5885b9dd7
x-transaction-id:
- 740bf6d5885b9dd7
x-twitter-response-tags:
- BouncerCompliant
x-xss-protection:
Expand Down
73 changes: 46 additions & 27 deletions tests/cassettes/test_threader/test_convert_to_post.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,89 @@ interactions:
- request:
body: null
headers:
Host:
- api.twitter.com
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Cookie:
- guest_id=v1%3A167335706915371511; guest_id_ads=v1%3A167335706915371511; guest_id_marketing=v1%3A167335706915371511;
personalization_id="v1_1HhPwU0hUuQv5+SCXZOonA=="; lang=en
User-Agent:
- Python/3.10.6 Requests/2.28.1 Tweepy/4.12.1
method: GET
uri: https://api.twitter.com/1.1/statuses/show.json?id=266367358078169089&tweet_mode=extended
response:
body:
string: '{"created_at":"Thu Nov 08 02:31:41 +0000 2012","id":266367358078169089,"id_str":"266367358078169089","full_text":"RT
@TwitterEng: Bolstering our infrastructure. \"As usage patterns change, Twitter
can remain resilient.\" http:\/\/t.co\/uML86B6s","truncated":false,"display_text_range":[0,126],"entities":{"hashtags":[],"symbols":[],"user_mentions":[{"screen_name":"TwitterEng","name":"Twitter
Engineering","id":6844292,"id_str":"6844292","indices":[3,14]}],"urls":[{"url":"http:\/\/t.co\/uML86B6s","expanded_url":"https:\/\/engineering.twitter.com\/2012\/11\/bolstering-our-infrastructure.html","display_url":"engineering.twitter.com\/2012\/11\/bolste\u2026","indices":[106,126]}]},"source":"\u003ca
href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003eTwitter Web Client\u003c\/a\u003e","in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":783214,"id_str":"783214","name":"Twitter","screen_name":"Twitter","location":"everywhere","description":"What''s
happening?!","url":"https:\/\/t.co\/DAtOo6uuHk","entities":{"url":{"urls":[{"url":"https:\/\/t.co\/DAtOo6uuHk","expanded_url":"https:\/\/about.twitter.com\/","display_url":"about.twitter.com","indices":[0,23]}]},"description":{"urls":[]}},"protected":false,"followers_count":62090002,"friends_count":0,"listed_count":87559,"created_at":"Tue
Feb 20 14:35:54 +0000 2007","favourites_count":6227,"utc_offset":null,"time_zone":null,"geo_enabled":true,"verified":true,"statuses_count":15011,"lang":null,"contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"ACDED6","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme18\/bg.gif","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme18\/bg.gif","profile_background_tile":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1488548719062654976\/u6qfBBkF_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1488548719062654976\/u6qfBBkF_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/783214\/1646075315","profile_link_color":"1B95E0","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"F6F6F6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false,"translator_type":"regular","withheld_in_countries":[]},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"retweet_count":197,"favorite_count":138,"favorited":false,"retweeted":false,"possibly_sensitive":false,"possibly_sensitive_appealable":false,"lang":"en"}'
string: !!binary |
H4sIAAAAAAAAAKxWy27rNhD9FVabLupr623ZQNEmNwm66AMoAtxFFBCUPJLY0JRCUslNg/x7h5Il
W360BVp7YWmenJkzh353cgXMwIYy46yd+6olv9YvxE2I668Dbx165DsXP8R3Pd+ZOXzjrP04DuJl
ECXuMvHilZusrJxqozDCqRK9ilYIauCrTfH7Pfnx/pUbA+pWlmtyXQuNz1yWpG4V4bJQDEO1uWkV
zEnqXGlCWs1KIA2zXlKTvGKyhBnZxSE5k0TBlnH7o7ngIM08dUhlTLNOF+nCzPM6XbS//JzE17HG
E2ECmdu6nXXBhIaZs+G6EeytOyZVNr6zfnBnnh8/zhyMxw0H7azfnYrpyrASnx9Qo9+2GVbQv7Qa
FN1a41pa0bujsb0gqWRbsO0d68YjTGUEhVxC14hdn+MkDP2Vf9DcncTq5Ybn9jwPwcwLHz9sciX6
nPiAtpdrh68Nkxsc+d5Qd5awP8Lc9MdC3226sMNPF56XLrJxWp9wWp+OplWZrXD2rezj/+uoaeu7
fjwpznPjbgIfjx/YasyY25alresGOSOVguL79KDSg+gOIkGgUtZFLUT9mvZeMLT7C2TkcweUPlq6
YL1Bl58qaARiocbGM9NqauchEcUXlP18Tg06QJz33akueU6A06uthwWgjbdMAt8LD6DRC05ghYKz
EES5qHEBEKh2RC+g3l4rULb6DaAHb3aqLxUz32pSsaYBiSP84Rtn5hwDp4fYzZX5rY7b9qcnZ7ox
nfn7OYBedr+EUZbVrZni6ARxJzYTTLkzP+gBNal0PN/jB6oaVRvID/mhhxEoTfO6lchkceQtAz/C
/SwU4mgzKiLsLdeWU3eCZOknyeyIaVsgd4hB3yVeuA6idRSOTOsuLWeyF8Q7N7BP6C0xdGtyWheF
BjPgwvAt0D9rOQKlhJqCZJmwx8flxNPjgHnB9+89cvexvcgNl3hu5L0hSl5Lo3jWmhprHsPtusE1
NUiSWjBUn5NiT0+csKkFF0Azlj+VChPbDgnr71x9vrm9sbt/xoZvkfzpEauxTNsJb8seA52NRihV
sB1/vQSppZyXvPiHwLTD1xHO/nt8g+9Dwwf12WKaabKJLSbzwiSJwmTprdzYj6NwtYyR0OPn4vr6
6Y7KWm2ZmP/RlM6ZNGdK+/+zZUxKZLPjXb2QqLfGTD1nYcY4jN1lFHjRQUzB5dMID+96Fd26B1rN
N5AxRbNabTDzYHfXfc7Y4YvYW8X2e2DV3fmDNug+B1rckxPUDGPFPwMUnaHjqp3DoNtAwVph9uLh
n8ZUPgSc8Iz9FzCV4NXw3II2VINd2J1O1gb3uidyPUr3q0nNW2NpX0HZCmZpH1mxqkBgHbJfftWx
9IMlRCSO/fZjZ7lEwtKDCBk2h3PsMN5fmj63yJu7e3E8jgLzCmBGrlklPb1ZdhuFQbQXbo5dD0mk
1ppneEliHzReMS/wNypqry0mLA2NVj3H4QXlfPwFAAD//wMA6dCbzf4KAAA=
headers:
cache-control:
- no-cache, no-store, must-revalidate, pre-check=0, post-check=0
content-disposition:
- attachment; filename=json.json
content-encoding:
- gzip
content-length:
- '2814'
- '1127'
content-type:
- application/json;charset=utf-8
date:
- Sat, 09 Jul 2022 15:50:16 GMT
- Tue, 10 Jan 2023 13:24:30 GMT
expires:
- Tue, 31 Mar 1981 05:00:00 GMT
last-modified:
- Sat, 09 Jul 2022 15:50:16 GMT
- Tue, 10 Jan 2023 13:24:30 GMT
perf:
- '7626143928'
pragma:
- no-cache
server:
- tsa_f
set-cookie:
- guest_id_marketing=v1%3A165738181616614521; Max-Age=63072000; Expires=Mon,
08 Jul 2024 15:50:16 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- guest_id_ads=v1%3A165738181616614521; Max-Age=63072000; Expires=Mon, 08 Jul
2024 15:50:16 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- personalization_id="v1_CdtAmBmXZXRNYtQsfkHqZA=="; Max-Age=63072000; Expires=Mon,
08 Jul 2024 15:50:16 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
- lang=en; Path=/
- guest_id=v1%3A165738181616614521; Max-Age=63072000; Expires=Mon, 08 Jul 2024
15:50:16 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None
status:
- 200 OK
strict-transport-security:
- max-age=631138519
x-access-level:
- read-write-directmessages
x-connection-hash:
- 87d760f4fc8fa64787835b45a3da7ce3fe767940f2a442c2ff18102a59508cab
- 28567a4d8f437464d3c5d1d89e794596d45908ffb445621960de3780ed5dc5ce
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-rate-limit-limit:
- '900'
x-rate-limit-remaining:
- '898'
- '892'
x-rate-limit-reset:
- '1657382715'
- '1673357440'
x-response-time:
- '117'
- '140'
x-transaction:
- c5e5e6fffe4348f9
- cee4eb53d860140f
x-transaction-id:
- cee4eb53d860140f
x-twitter-response-tags:
- BouncerCompliant
x-xss-protection:
Expand Down
Loading

0 comments on commit e41c62c

Please sign in to comment.