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

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

Open
Saul-Github opened this issue Sep 1, 2024 · 7 comments

Comments

@Saul-Github
Copy link

Saul-Github commented Sep 1, 2024

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!

@otterolie
Copy link

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"
)

@DemianOportus
Copy link

Here is my solution:

@bethylamine
Copy link

bethylamine commented Sep 6, 2024

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
Copy link

bethylamine commented Sep 6, 2024

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.

@mbfczzz
Copy link

mbfczzz commented Sep 6, 2024

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

@0n7
Copy link

0n7 commented Sep 8, 2024

up

@EyalShechtman
Copy link

EyalShechtman commented Sep 19, 2024

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

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

7 participants