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

Issue 23: Display public IP address #85

Closed
wants to merge 1 commit into from
Closed

Issue 23: Display public IP address #85

wants to merge 1 commit into from

Conversation

shivangswain
Copy link
Collaborator

Added a method to fetch and display public IP address in the server verbose

Linked Issue: #23

Added a method to get and display public IP address in the server verbose
@shivangswain shivangswain self-assigned this Oct 22, 2020
@shivangswain shivangswain linked an issue Oct 22, 2020 that may be closed by this pull request
Copy link
Owner

@gridhead gridhead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at the changes I have suggested.

@@ -2,6 +2,7 @@
from prompt_toolkit import print_formatted_text, HTML
from websockets.exceptions import ConnectionClosedError
from utils.helper_display import HelperDisplay
from requests import get
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requests is quite a heavy module to import for task as small as this. Also, we cannot just assume that the users have curl or wget binaries installed on their distribution which makes it a difficult point to discuss about.

Comment on lines +32 to +33
def ipaddress():
return get('https://api64.ipify.org').text
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does a great job in retrieving an IPv6 address as evidenced in the screenshot I have attached just below.

image

But when it comes to IPv4, it still ends up fetching the IPv6 address.

image

servenow(netpdata, chatport)
except OSError:
print_formatted_text(HTML("[" + obtntime() + "] " + "<b>SNCTRYZERO</b> > <red><b>The server could not be started up</b></red>"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch with the corrected message. 😉

@gridhead
Copy link
Owner

Any updates, @shivangswain?

@shivangswain
Copy link
Collaborator Author

Yeah, changing the whole implementation to use urllib3. ETA: 30 mins.

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.

Fetch and display the IPv4/IPv6 address on the verbose
2 participants