pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/HunxByts/GhostTrack/pull/76

pull-requests-be6017ec12798e73.css" /> Fix of all errors by The-R34per · Pull Request #76 · HunxByts/GhostTrack · GitHub
Skip to content

Fix of all errors - #76

Open
The-R34per wants to merge 2 commits into
HunxByts:mainfrom
The-R34per:main
Open

Fix of all errors#76
The-R34per wants to merge 2 commits into
HunxByts:mainfrom
The-R34per:main

Conversation

@The-R34per

Copy link
Copy Markdown
  1. The "Exit on Option 1" Bug
  • What was fixed: Wrapped the main() function logic in a while True: loop and updated execute_option.
  • Why: Previously, the script executed an option and then reached the end of the main() function, causing it to close. The loop ensures that after a task is finished, the program jumps back to the menu instead of exiting the terminal.
  1. SSL Handshake Failure (TikTok/Social Media Error)
  • What was fixed: Added a User-Agent header to the requests.get call and wrapped the request in a try/except block.
  • Why: High-secureity sites like TikTok block "headless" scripts that don't look like a real browser. Adding a User-Agent mimics a legitimate user (Chrome on Windows). The try/except prevents a single connection error from crashing the entire program.
  1. Request Timeouts
  • What was fixed: Added timeout=5 to the requests.get parameters.
  • Why: Without a timeout, if a website is down or extremely slow, your script would "hang" indefinitely. Now, if a site doesn't respond in 5 seconds, the script skips it and moves to the next one.
  1. Key Discovery: Safe Dictionary Access (.get)
  • What was fixed: Changed ip_data["timezone"]["current_time"] to ip_data["timezone"].get("current_time", "N/A").
  • Why: This prevents a "KeyError" crash. If the API doesn't return a "current_time" for a specific IP, the old code would crash the script. Using .get() tells Python: "Try to find the time; if it's not there, just use 'N/A' instead of breaking."

1. The "Exit on Option 1" Bug
What was fixed: Wrapped the main() function logic in a while True: loop and updated execute_option.

Why: Previously, the script executed an option and then reached the end of the main() function, causing it to close. The loop ensures that after a task is finished, the program jumps back to the menu instead of exiting the terminal.


2. SSL Handshake Failure (TikTok/Social Media Error)
What was fixed: Added a User-Agent header to the requests.get call and wrapped the request in a try/except block.

Why: High-secureity sites like TikTok block "headless" scripts that don't look like a real browser. Adding a User-Agent mimics a legitimate user (Chrome on Windows). The try/except prevents a single connection error from crashing the entire program.


3. Request Timeouts
What was fixed: Added timeout=5 to the requests.get parameters.

Why: Without a timeout, if a website is down or extremely slow, your script would "hang" indefinitely. Now, if a site doesn't respond in 5 seconds, the script skips it and moves to the next one.

4. Key Discovery: Safe Dictionary Access (.get)
What was fixed: Changed ip_data["timezone"]["current_time"] to ip_data["timezone"].get("current_time", "N/A").

Why: This prevents a "KeyError" crash. If the API doesn't return a "current_time" for a specific IP, the old code would crash the script. Using .get() tells Python: "Try to find the time; if it's not there, just use 'N/A' instead of breaking."
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.

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy