iSarabjitDhiman / TweeterPy

TweeterPy is a python library to extract data from Twitter. TweeterPy API lets you scrape data from a user's profile like username, userid, bio, followers/followings list, profile media, tweets, etc.
MIT License
145 stars 20 forks source link

login error - unable to handle suspicious login #30

Closed xnzhao196 closed 1 year ago

xnzhao196 commented 1 year ago

File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/tweeterpy.py", line 207, in login TaskHandler().login(username, password) File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/logging_util.py", line 45, in wrapper raise error File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/logging_util.py", line 43, in wrapper returned_output = original_function(*args, **kwargs) File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/login_util.py", line 126, in login raise error File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/login_util.py", line 103, in login task_id = [task_id for task_id in task_flow_mapper.keys() if task_id in tasks][0] IndexError: list index out of range

password is right ,thx for your reply

iSarabjitDhiman commented 1 year ago

File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/tweeterpy.py", line 207, in login TaskHandler().login(username, password) File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/logging_util.py", line 45, in wrapper raise error File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/logging_util.py", line 43, in wrapper returned_output = original_function(*args, **kwargs) File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/login_util.py", line 126, in login raise error File "/usr/local/anaconda3/envs/eth_fi/lib/python3.10/site-packages/tweeterpy/login_util.py", line 103, in login task_id = [task_id for task_id in task_flow_mapper.keys() if task_id in tasks][0] IndexError: list index out of range

password is right ,thx for your reply

Do you have two-factor authentication enabled on your twitter account? Are you using a mobile number or an email to login?

Also check, when u get the error, do u also get some email or some code on your mobile number?

xnzhao196 commented 1 year ago

Do you have two-factor authentication enabled on your twitter account? No Are you using a mobile number or an email to login? yes, email

how should i do next ?

iSarabjitDhiman commented 1 year ago

Do you have two-factor authentication enabled on your twitter account? No Are you using a mobile number or an email to login? yes, email

how should i do next ?

Hey @xnzhao196

Can you modify the code? If yes, go to the login_util.py module and just below the line 101 (inside while loop) add the following line:

print(tasks)

Once you have modified the code, try to log in again and just copy paste the most recent output it showed before throwing the error. Before pasting the output here, make sure it doesn't include any password or username.

If you are unable to find the TweeterPy installation directory, do this :

pip install tweeterpy --upgrade

It would say something like : requirement is already satisfied and will show the path to the installation directory.

xnzhao196 commented 1 year ago

hi , iSarabjitDhiman

I logged in with the user name and saved the session. everything is OK now. Thank you for your contribution

iSarabjitDhiman commented 1 year ago

hi , iSarabjitDhiman

I logged in with the user name and saved the session. everything is OK now. Thank you for your contribution

So it was some issue on your side and it's working now? If everything seems to be working fine, feel free to close the issue or let me know I will close it.

Thanks for the update.

xnzhao196 commented 1 year ago

If I use email to log in, the problem still persists, Twitter should have set up login verification, so I switch to the account name login, this is the same account, for me to log in with a user name can work

iSarabjitDhiman commented 1 year ago

If I use email to log in, the problem still persists, Twitter should have set up login verification, so I switch to the account name login, this is the same account, for me to log in with a user name can work

Oh I see. So you mean if you log in with the email it won't work, but if you log in with the user name it works? Thats strange. Let me see if there is an issue.

iSarabjitDhiman commented 1 year ago

Hi @xnzhao196 Just fixed it, try to log in again and let me know how it goes.