twikit icon indicating copy to clipboard operation
twikit copied to clipboard

BadRequest: status: 400, message: "{"errors":[{"code":366,"message":"flow name LoginFlow is currently not accessible"}]}"

Open Saul-Github opened this issue 1 year ago • 7 comments

After trying the method of using user-agent, I still got this error.

Here are the codes:

import asyncio from twikit import Client

USERNAME = 'XXX' EMAIL = 'XXX' PASSWORD = XXX'

client = Client(user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...')

async def main(): await client.login( auth_info_1=USERNAME, auth_info_2=EMAIL, password=PASSWORD )

asyncio.run(main())

Any suggestions, thank you!

Saul-Github avatar Sep 01 '24 10:09 Saul-Github

Change the user agent to something else:

ie

client = Client( user_agent="Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15A372 Safari/604.1" )

otterolie avatar Sep 01 '24 14:09 otterolie

Here is my solution:

DemianOportus avatar Sep 01 '24 16:09 DemianOportus

Currently seeing this error, on accounts with/without 2FA. Tried a couple different user agents, including of course the one from the browser I'm logged into the account with

twikit.errors.BadRequest: status: 400, message: "{"errors":[{"code":366,"message":"flow name LoginFlow is currently not accessible"}]}"

Code I'm trying to run:

import trio
from twikit import Client

USERNAME = 'SomeUsername'
EMAIL = '[email protected]'
PASSWORD = 'ABCXYZ'
# TOTP_SECRET = '000000'
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36'

# Initialize client
client = Client('en-US',
                user_agent=USER_AGENT)


async def main():
    await client.login(
        auth_info_1=USERNAME,
        auth_info_2=EMAIL,
        password=PASSWORD,
        # totp_secret=TOTP_SECRET
    )
    client.save_cookies('cookies.json')

    notifications = await client.get_notifications('All')
    for notification in notifications:
        print(notification)


trio.run(main)

Dependencies:

❯ poetry show
anyio            4.4.0       High level compatibility layer for multiple asyn...
attrs            24.2.0      Classes Without Boilerplate
beautifulsoup4   4.12.3      Screen-scraping library
certifi          2024.8.30   Python package for providing Mozilla's CA Bundle.
filetype         1.2.0       Infer file type and MIME type of any file/buffer...
h11              0.14.0      A pure-Python, bring-your-own-I/O implementation...
httpcore         1.0.5       A minimal low-level HTTP client.
httpx            0.27.2      The next generation HTTP client.
idna             3.8         Internationalized Domain Names in Applications (...
lxml             5.3.0       Powerful and Pythonic XML processing library com...
outcome          1.3.0.post0 Capture the outcome of Python function calls.
pyotp            2.9.0       Python One Time Password Library
sniffio          1.3.1       Sniff out which async library your code is runni...
socksio          1.0.0       Sans-I/O implementation of SOCKS4, SOCKS4A, and ...
sortedcontainers 2.4.0       Sorted Containers -- Sorted List, Sorted Dict, S...
soupsieve        2.6         A modern CSS selector implementation for Beautif...
trio             0.26.2      A friendly Python library for async concurrency ...
twikit           2.1.3       Twitter API wrapper for python with **no API key...

bethylamine avatar Sep 06 '24 08:09 bethylamine

From the Discord community announcement channel:

d60 — 08/23/2024 8:14 AM Version 2.1.3

  • Fixed KeyError: 'open_account'"
  • flow name LoginFlow is currently not accessible has not yet been fixed.

So this is a known issue being worked on.

bethylamine avatar Sep 06 '24 08:09 bethylamine

I had the same problem last night, but I fixed the user agent and it was fine.

mbfczzz avatar Sep 06 '24 09:09 mbfczzz

up

0n7 avatar Sep 08 '24 18:09 0n7

I had the same problem last night, but I fixed the user agent and it was fine.

so what did you change your user agent to? when I change my user agent, the same problem persists

EyalShechtman avatar Sep 19 '24 20:09 EyalShechtman

try version 2.2.0

d60 avatar Dec 01 '24 11:12 d60