twikit icon indicating copy to clipboard operation
twikit copied to clipboard

Twitter Denying Access for create_tweet()

Open PhatStraw opened this issue 1 year ago • 3 comments

await client.create_tweet(text="reply here", reply_to="432432")

gets this error

Traceback (most recent call last): File "/Users/kevinsims/Code/twitter-automate/index.py", line 141, in asyncio.run(main()) File "/opt/homebrew/Cellar/[email protected]/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/Users/kevinsims/Code/twitter-automate/index.py", line 51, in main await client.create_tweet("testinggg") File "/opt/homebrew/lib/python3.12/site-packages/twikit/client/client.py", line 1241, in create_tweet _result = response['data']['create_tweet']['tweet_results']

PhatStraw avatar Oct 03 '24 19:10 PhatStraw

Looks like twitter is restricting usage

added a print to twitkit/client/client.py python response, _ = await self.gql.create_tweet( is_note_tweet, text, media_entities, poll_uri, reply_to, attachment_url, community_id, share_with_followers, richtext_options, edit_tweet_id, limit_mode ) print(response) _result = response['data']['create_tweet']['tweet_results']

Got python {'errors': [{'message': "Authorization: This request looks like it might be automated. To protect our users from spam and other malicious activity, we can't complete this action right now. Please try again later. (226)", 'locations': [{'line': 18, 'column': 3}], 'path': ['create_tweet'], 'extensions': {'name': 'AuthorizationError', 'source': 'Client', 'code': 226, 'kind': 'Permissions', 'tracing': {'trace_id': '036e71f21ad8f53d'}}, 'code': 226, 'kind': 'Permissions', 'nam'}}]

PhatStraw avatar Oct 04 '24 06:10 PhatStraw

same problem

CoderMike1 avatar Oct 04 '24 13:10 CoderMike1

I have the same proble, sometimes the crate_tweet funtion fails

Error al enviar el tweet: 'create_tweet' Traceback (most recent call last): File "c:\proyectos\monitoreo de grupos de interés twitter\lobby_spain_twitter.py", line 266, in main tweet = await client.create_tweet(text, reply_to=reply_to) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USUARIO\anaconda3\Lib\site-packages\twikit\client\client.py", line 1241, in create_tweet _result = response['data']['create_tweet']['tweet_results'] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ KeyError: 'create_tweet'

AritzUMA avatar Oct 10 '24 08:10 AritzUMA

did anyone find any fix for this?

muhammad-usama-aleem avatar Nov 02 '24 21:11 muhammad-usama-aleem

fixed in v2.2.0

d60 avatar Dec 05 '24 07:12 d60

If someone still facing this issue, it might be because Twitter API doesn't work on new accounts. You need to make some post manually or complete the instructions which Twitter gives on new accounts to help grow it.

muhammad-usama-aleem avatar Dec 06 '24 08:12 muhammad-usama-aleem