Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two errors, one message is : status: 400, message: "{"errors":[{"code":399,"message":"Incorrect. Please try again. #276

Open
dh12306 opened this issue Dec 25, 2024 · 2 comments

Comments

@dh12306
Copy link

dh12306 commented Dec 25, 2024

the first error is that login was blocked, and I try again after a while ,the problem seems to be solved

Traceback (most recent call last):
  File "E:\crawler\twikit\examples\mytest.py", line 37, in <module>
    asyncio.run(main())
  File "D:\rj\ana3\envs\py106\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\rj\ana3\envs\py106\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "E:\crawler\twikit\examples\mytest.py", line 19, in main
    await client.login(
  File "E:\crawler\twikit\twikit\client\client.py", line 414, in login
    raise TwitterException(flow.response['subtasks'][0]['cta']['secondary_text']['text'])
twikit.errors.TwitterException: We blocked an attempt to access your account because we weren't sure it was really you.

This happens when we notice unusual login activity, like an attempt to log in too many times, or from a different location or device.

You'll need to wait before trying to log in again. Some blocks are removed automatically.

Get help with login issues.

by the way , my proxy is 'https://127.0.0.1:7897' ,is that fine ?

client = Client('en-US',proxy = 'https://127.0.0.1:7897' )

then the second one was happened,error message was here:

Traceback (most recent call last):
  File "E:\crawler\twikit\examples\mytest.py", line 37, in <module>
    asyncio.run(main())
  File "D:\rj\ana3\envs\py106\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\rj\ana3\envs\py106\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "E:\crawler\twikit\examples\mytest.py", line 19, in main
    await client.login(
  File "E:\crawler\twikit\twikit\client\client.py", line 439, in login
    await flow.execute_task({
  File "E:\crawler\twikit\twikit\utils.py", line 88, in execute_task
    response, _ = await self._client.v11.onboarding_task(
  File "E:\crawler\twikit\twikit\client\v11.py", line 90, in onboarding_task
    return await self.base.post(
  File "E:\crawler\twikit\twikit\client\client.py", line 214, in post
    return await self.request('POST', url, **kwargs)
  File "E:\crawler\twikit\twikit\client\client.py", line 185, in request
    raise BadRequest(message, headers=response.headers)
twikit.errors.BadRequest: status: 400, message: "{"errors":[{"code":399,"message":"Incorrect. Please try again. g;173510882678047688:-1735108827231:4juRWUb2RpjGJ7ySiGNelgdX:9"}]}"

and I just want to search something on x:

import asyncio

from twikit import Client

# Enter your account information
USERNAME = ''
EMAIL = ''
PASSWORD = ''
totp_secret = ''
client = Client('en-US') #'https://127.0.0.1:7897'

async def main():
    # Asynchronous client methods are coroutines and
    # must be called using `await`.
    await client.login(
        auth_info_1=USERNAME,
        auth_info_2=EMAIL,
        password=PASSWORD,
        totp_secret = totp_secret
    )
    ###########################################
    print('--login done--')
    # Search Latest Tweets
    tweets = await client.search_tweet('girl', 'Latest')
    for tweet in tweets:
        print(tweet)
    # Search more tweets
    more_tweets = await tweets.next()
    for tweet in more_tweets:
        print('--'*10)
        print(tweet)

asyncio.run(main())

can you help me @d60 thx

@naynaingoo2003
Copy link

remove two-factor authentication method

1 similar comment
@naynaingoo2003
Copy link

remove two-factor authentication method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants