Skip to content

Improve error handling and email visibility in core.py#190

Open
debpramanik wants to merge 1 commit intomegadose:masterfrom
debpramanik:debpramanik-patch-1
Open

Improve error handling and email visibility in core.py#190
debpramanik wants to merge 1 commit intomegadose:masterfrom
debpramanik:debpramanik-patch-1

Conversation

@debpramanik
Copy link

Issue Fixed

The tool was crashing on certain accounts (e.g., private accounts without IGTV data) due to a KeyError when accessing missing API fields.

Error Example

Informations about     : [username redacted]
userID                 : [userID redacted]
Full Name              : [full name redacted]
Verified               : False | Is buisness Account : False
Is private Account     : True
Follower               : 7 | Following : 12
Number of posts        : 0
Traceback (most recent call last):
  File ".../toutatis/core.py", line 125, in main
    print("IGTV posts             : " + str(infos["total_igtv_videos"]))
                                            ~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: 'total_igtv_videos'

Changes Made

  1. Fixed KeyError - Used safe dictionary access (.get()) for total_igtv_videos field
  2. Enhanced public email reporting - Always indicate presence/absence of public email
  3. Enhanced obfuscated email reporting - Always indicate presence/absence of obfuscated email

Benefits

  • ✅ Prevents crashes when processing accounts with missing API fields
  • ✅ Improves robustness and user experience
  • ✅ Provides clearer, more consistent output

Files Changed

  • toutatis/core.py

Testing

Verified on multiple Instagram usernames including:

  • Private accounts
  • Accounts without IGTV content
  • Various account types

No crashes observed, and email status is now always reported consistently.

The following error occurred when running the tool on some accounts (e.g., private accounts without IGTV data):
Informations about     : [username redacted]
userID                 : [userID redacted]
Full Name              : [full name redacted]
Verified               : False | Is buisness Account : False
Is private Account     : True
Follower               : 7 | Following : 12
Number of posts        : 0
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/toutatis/core.py", line 125, in <module>
    sys.exit(load_entry_point('toutatis==1.31', 'console_scripts', 'toutatis')())
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/toutatis/core.py", line 125, in main
    print("IGTV posts             : " + str(infos["total_igtv_videos"]))
                                            ~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: 'total_igtv_videos'

Changes Made:

Fixed KeyError by using safe dictionary access for 'total_igtv_videos'.
Enhanced public email reporting to always indicate presence/absence.
Enhanced obfuscated email reporting to always indicate presence/absence.
Benefits: Prevents crashes, improves robustness, and provides clearer output for users.

Files Changed: toutatis/toutatis/core.py

Testing: Verified on multiple usernames; no crashes, and email status is now always reported.
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

Successfully merging this pull request may close these issues.

1 participant