astrodbtoolkit / astrodbtoolkit/astrodb_utils

troubleshoot `internet_connection` function

Open
#114 0 comments 0 reactions 0 assignees View on GitHub
bug high priority
Dominant language
Python
Stars
0
Forks
10
PR merge metrics
No merged PRs in 30d

Description

Currently, it checks the IP address of the current machine. Not sure that actually checks if there's an active internet connection:
```python
def internet_connection():
"""Test internet connection - not clear if that's actually what's happening here"""

# get current IP address of system
ipaddress = socket.gethostbyname(socket.gethostname())

# checking system IP is the same as "127.0.0.1" or not.
if ipaddress == "127.0.0.1": # no internet
return False, ipaddress
else:
return True, ipaddress
```

maybe this instead?
```python
def check_internet():
try:
res = socket.getaddrinfo('google.com',80)
return True
except:
return False
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the `internet_connection` function shown in the issue and inspect how its return value is used. Compare the current localhost check with the proposed connectivity check, then define and test the expected behavior for reachable and unavailable networks; done means the function’s result matches that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.