Mopidy-WaitForInternet
Mopidy extensions that wait (up to around 5 minutes) for an internet connection (and optionally for time synchronization) during early phase of Mopidy startup (before other extensions start to initialize).
Installation
Install by running:
pip install Mopidy-WaitForInternet
Configuration
This package consists of two Mopidy extensions - mopidy_waitforinternet (enabled by default) that waits only for internet connection and mopidy_waitfortimesync (disabled by default) that waits for internet connection and time synchronization. They have no configuration options in mopidy.conf apart from the default enabled setting:
# To enable waiting for internet connection and time synchronization [waitforinternet] enabled = false [waitfortimesync] enabled = true
These extensions don’t support proxy servers (they ignore proxy configuration in mopidy.conf).
Usage
Mopidy-WaitForInternet might be useful if other Mopidy extensions (e.g. extensions for online music streaming services) fail to initialize, because they try to connect to internet resources before machine running Mopidy has established an internet connection (e.g. connected to wifi) or synchronized its clock.
mopidy_waitforinternet will delay initialization of other Mopidy extensions until an internet connection has been established (the extension will wait for up to around 5 minutes). It’s recommended if:
the computer running Mopidy has a real-time clock
all of the below:
it is important to minimize Mopidy startup time
it is acceptable if other Mopidy extensions occasionally (once in several months or so) fail to initialize due to inaccurate date/time
the computer does not have a real-time clock
the computer/OS saves the time between reboots (like Raspberry Pi OS does)
the computer is used often
mopidy_waitfortimesync will delay initialization of other Mopidy extensions until an internet connection has been established and computer’s clock has been synchronized (the extension will wait for up to around 5 minutes). It’s recommended if:
prolonged Mopidy startup time is not a problem
it is important to minimize initialization failures of other Mopidy extensions
the computer running Mopidy does not have a real-time clock and is used rarely
Local time (computer’s clock) is somewhat important for connectivity. Most internet services use HTTPS and HTTPS has certificates that are valid for a specific time period (usually 3 or 13 months). To connect to an HTTPS resource, computer’s clock must be within the validity period of the HTTPS certificate used by that particular resource. Some computers (e.g. Raspberry Pi) don’t have real-time clocks and synchronize their clocks from the internet (via NTP). In most cases, until the clock of such computer is synchronized it is set to the time saved at previous shutdown, for some computers the clock is set to a constant time/date (e.g. midnight January 1, 2020). As mopidy_waitforinternet uses HTTPS, it will detect internet connectivity only when computer’s clock is within the validity period of the HTTPS certificate of at least one of the URLs used by mopidy_waitforinternet. This guarantees that computer’s clock has accuracy of a year or so, however this does not guarantee that computer’s clock is accurate enough to allow connectivity (to other HTTPS resources) required by other Mopidy extensions.
Both extensions log information about the introduced startup delay.
Important internals
Mopidy-WaitForInternet uses several different URLs (currently - requests to public DoH servers) to check internet connectivity. As a future-proofing measure there is a weekly servers-test build that verifies availability of these URLs.
Time synchronization is checked by comparing local time with the Date response header of HTTP requests to the internet connectivity check URLs (difference of less than 10 seconds is considered synchronized time).
License
Copyright 2022-2025 Davis Mosenkovs
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Project resources
Changelog
v0.2.2
Updated connectivity check URLs (switched from Quad9 to AdGuard).
v0.2.1
Fixed build badges (including servers-test).
v0.2.0
Added second extension (mopidy_waitfortimesync).
Minor improvements.
v0.1.1
Fixed README formatting.
Initial release.
v0.1.0 (UNRELEASED)
Initial version.
Metadata
Release files for Mopidy-WaitForInternet 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mopidy_waitforinternet-0.2.2.tar.gz | 11.4 kB | Without provenance | Details for mopidy_waitforinternet-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Mopidy_WaitForInternet-0.2.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for Mopidy_WaitForInternet-0.2.2-py2.py3-none-any.whl |
Total release size: 21.7 kB
Release files / mopidy_waitforinternet-0.2.2.tar.gz
| Download URL | mopidy_waitforinternet-0.2.2.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0a82d770122e7689887656ca2999b2bb527e17fe8082e44e562627367b39e32
|
|
BLAKE2b-256 checksum How to use checksums |
56b63954a33622d6170b74f12a9273d8515fb387ba55eb363360ad7e8bcd2dc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.12
|
Release files / Mopidy_WaitForInternet-0.2.2-py2.py3-none-any.whl
| Download URL | Mopidy_WaitForInternet-0.2.2-py2.py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
90f61628a13394e45d053869899e1e10ab2c1259a4549ef77632ff30d5570e60
|
|
BLAKE2b-256 checksum How to use checksums |
92a410340208eeb33cc0b87f084ed55d20132bce112623dbc2ab312f9ed02273
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.12
|
Security for Mopidy-WaitForInternet 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.