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

Login Issue Persist After Update #221

Closed
seleron opened this issue Nov 23, 2024 · 4 comments
Closed

Login Issue Persist After Update #221

seleron opened this issue Nov 23, 2024 · 4 comments

Comments

@seleron
Copy link

seleron commented Nov 23, 2024

The updated code doesn't work properly for me.

When tried without a session file or cookies but with un and password getting this error:

2024-11-22 23:54:10 DEBUG:receive_response_headers.started request=<Request [b'GET']> stream_id=3
2024-11-22 23:54:10 DEBUG:receive_response_headers.failed exception=RuntimeError('<asyncio.locks.Event object at 0xXXXXXXXX [unset]> is bound to a different event loop')
2024-11-22 23:54:10 DEBUG:response_closed.started stream_id=3
2024-11-22 23:54:10 DEBUG:response_closed.complete
2024-11-22 23:54:10 ERROR:Authentication failed: invalid response
2024-11-22 23:54:10 ERROR:Authentication failed: invalid response
Traceback (most recent call last):
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 39, in authenticate
self.perform_authentication(username, password, extra)
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 63, in perform_authentication
raise auth_error
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 55, in perform_authentication
self.twitter_app.start(username, password, extra=extra)
File "<ANONYMIZED_PATH>/site-packages/tweety/init.py", line 21, in wrapper
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 56, in start
return await self.sign_in(username, password, extra=_extra)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 103, in sign_in
return await self._login()
^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 164, in _login
response = await self.request.login(self._login_url, _payload=_login_payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/http.py", line 342, in login
response = await self.get_response(True, **request_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/http.py", line 176, in get_response
await self._init_local_api()
File "<ANONYMIZED_PATH>/site-packages/tweety/http.py", line 167, in _init_local_api
self._transaction = TransactionGenerator(home_page_html)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/transaction.py", line 105, in init
self.home_page_html = self.validate_response(home_page_html)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/transaction.py", line 129, in validate_response
raise Exception("invalid response")
Exception: invalid response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 107, in main
trend_fetcher.authenticate(username=username, password=password)
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 42, in authenticate
self.perform_authentication(username, password, extra)
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 63, in perform_authentication
raise auth_error
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 55, in perform_authentication
self.twitter_app.start(username, password, extra=extra)
File "<ANONYMIZED_PATH>/site-packages/tweety/init.py", line 21, in wrapper
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 56, in start
return await self.sign_in(username, password, extra=_extra)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 103, in sign_in
return await self._login()
^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 164, in _login
response = await self.request.login(self._login_url, _payload=_login_payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/http.py", line 342, in login
response = await self.get_response(True, **request_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/http.py", line 176, in get_response
await self._init_local_api()
File "<ANONYMIZED_PATH>/site-packages/tweety/http.py", line 167, in _init_local_api
self._transaction = TransactionGenerator(home_page_html)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/transaction.py", line 105, in init
self.home_page_html = self.validate_response(home_page_html)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/transaction.py", line 129, in validate_response
raise Exception("invalid response")
Exception: invalid response

When tried with session file and cookie, getting this error:

2024-11-23 00:02:47 DEBUG:response_closed.started stream_id=17
2024-11-23 00:02:47 DEBUG:response_closed.complete
2024-11-23 00:02:47 ERROR:Authentication failed: 'Request' object has no attribute 'set_cookies'
2024-11-23 00:02:47 ERROR:Authentication failed: 'Request' object has no attribute 'set_cookies'
Traceback (most recent call last):
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 34, in authenticate
self.twitter_app.connect()
File "<ANONYMIZED_PATH>/site-packages/tweety/init.py", line 21, in wrapper
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 22, in connect
await self.request.verify_cookies()
File "<ANONYMIZED_PATH>/site-packages/tweety/http.py", line 317, in verify_cookies
raise InvalidCredentials(None, None, None)
tweety.exceptions.InvalidCredentials: The Cookies are Invalid

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 107, in main
trend_fetcher.authenticate(username=username, password=password)
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 42, in authenticate
self.perform_authentication(username, password, extra)
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 63, in perform_authentication
raise auth_error
File "<ANONYMIZED_PATH>/<ANONYMIZED_FILE>.py", line 55, in perform_authentication
self.twitter_app.start(username, password, extra=extra)
File "<ANONYMIZED_PATH>/site-packages/tweety/init.py", line 21, in wrapper
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 56, in start
return await self.sign_in(username, password, extra=_extra)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ANONYMIZED_PATH>/site-packages/tweety/auth.py", line 89, in sign_in
self.request.set_cookies("", False)
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Request' object has no attribute 'set_cookies'

@ContentPixelLLC
Copy link

Getting this and 'NoneType' object has no attribute 'ct0'

@zaksiddiqengineer
Copy link

Getting this and 'NoneType' object has no attribute 'ct0'

How are you logging in? Exacrlt

@mahrtayyab
Copy link
Owner

d64e98b

@mahrtayyab
Copy link
Owner

run pip install lxml

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

4 participants