Comments (3)
Instead of using ping as per this code
https://github.com/joshiayush/inb/blob/master/inb/lib/utils/net.py
Why not use wget or curl and download google.com's homepage and then delete the temp file to test the internet e.g.
wget -O inb-test-google-index.html google.com
rm inb-test-google-index.html
inb needs port 80/443 open while ping uses another, non-standard port
from inb.
Here's the fix for the problem with pinging not being allowed when running ping 8.8.8.8
and getting this error ping: socket: Operation not permitted
, likely caused by using inb in an lxd container or similar...
Find out where the ping package is.It might have a different location. On my Ubuntu 18.04 machine, it is in /bin. Use
type -a ping
to locate it. Next, verify that it is there and is owned by root and is permed 755 (or similar)
ls -lsa /bin/ping
sudo chmod 4711 /bin/ping
Verify that the fix worked
ls -lsa /bin/ping
ping 8.8.8.8
ping 2600:3c01::f03c:92ff:fe3b:2efa
Via https://askubuntu.com/a/1189359
from inb.
We need to replace the current ping
function with the function is_internet_alive()
defined below in order to make it platform independent. I guess Python
socket will not have any issue with a LXD
container.
Lines 29 to 52 in 57fe58d
Possible solutions
def is_internet_alive(host: str = '1.1.1.1', port: int = 53, timeout: int = 3) -> bool:
"""Check if Internet Connection is alive and external IP address is reachable.
Args:
host (string): 1.1.1.1 (DNS servver)
port (integer): (53/tcp DNS Service).
timeout (float): timeout in seconds.
Returns:
True (bool): if external IP address is reachable.
False (bool): if external IP address is unreachable.
"""
try:
socket.setdefaulttimeout(timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
except OSError as error:
return False
else:
s.close()
return True
from inb.
Related Issues (20)
- Arm64 compatibility HOT 2
- Install `chromedriver` to a local system path and then extend the environment path
- Replace `MIT` License with `BSD 3-Clause` license HOT 1
- When unit testing `version` variable inside function `_GetGoogleChromeBinaryVersion()` changes its type to `mock.Mock` :(
- Instructions on linkedin.message template HOT 1
- TimeoutException in _GetElementByXPath while running the search Command HOT 5
- Validate `chromedriver_path` before passing it to `webdriver.Chrome`
- `_InstallGoogleChromeCompatibleChromeDriver()` should have the ability to automatically detect correct `chromedriver` version HOT 1
- Docker setup HOT 8
- Change primary branch from `master` to `main` HOT 1
- Why should we use `LIST` parameters? HOT 1
- Broken `pytest` workflow HOT 1
- Could we have keywords as a multiple parameter? HOT 2
- Edge case on printing the debug message
- Building image from Docker HOT 3
- inb.py not providing any output HOT 2
- Linux issue HOT 3
- LinkedInChallengeException HOT 3
- Typo on README.md
- Publish image over Docker Hub
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inb.