Skip to content

Commit

Permalink
Fixed key error
Browse files Browse the repository at this point in the history
  • Loading branch information
d60 committed Aug 23, 2024
1 parent daeb08f commit 6d19016
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion twikit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
A Python library for interacting with the Twitter API.
"""

__version__ = '2.1.2'
__version__ = '2.1.3'

import asyncio
import os
Expand Down
37 changes: 28 additions & 9 deletions twikit/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@
from ..bookmark import BookmarkFolder
from ..community import Community, CommunityMember
from ..constants import TOKEN
from ..errors import (AccountLocked, AccountSuspended, BadRequest,
CouldNotTweet, Forbidden, InvalidMedia, NotFound,
RequestTimeout, ServerError, TooManyRequests,
TweetNotAvailable, TwitterException, Unauthorized,
UserNotFound, UserUnavailable,
raise_exceptions_from_response)
from ..errors import (
AccountLocked,
AccountSuspended,
BadRequest,
CouldNotTweet,
Forbidden,
InvalidMedia,
NotFound,
RequestTimeout,
ServerError,
TooManyRequests,
TweetNotAvailable,
TwitterException,
Unauthorized,
UserNotFound,
UserUnavailable,
raise_exceptions_from_response
)
from ..geo import Place, _places_from_response
from ..group import Group, GroupMessage
from ..list import List
Expand All @@ -32,8 +44,15 @@
from ..trend import Location, PlaceTrend, PlaceTrends, Trend
from ..tweet import CommunityNote, Poll, ScheduledTweet, Tweet, tweet_from_data
from ..user import User
from ..utils import (Flow, Result, build_tweet_data, build_user_data,
find_dict, find_entry_by_type, httpx_transport_to_url)
from ..utils import (
Flow,
Result,
build_tweet_data,
build_user_data,
find_dict,
find_entry_by_type,
httpx_transport_to_url
)
from .gql import GQLClient
from .v11 import V11Client

Expand Down Expand Up @@ -388,7 +407,7 @@ async def login(
if not flow.response['subtasks']:
return

self._user_id = flow.response['subtasks'][0]['open_account']['user']['id_str']
self._user_id = find_dict(flow.response, 'id_str', find_one=True)[0]

if flow.task_id == 'LoginTwoFactorAuthChallenge':
if totp_secret is None:
Expand Down

0 comments on commit 6d19016

Please sign in to comment.