Skip to content

Commit

Permalink
Merge pull request #8 from psmsmets/openholidays_timeout
Browse files Browse the repository at this point in the history
openholidays timeout
  • Loading branch information
psmsmets authored Sep 21, 2023
2 parents 7023973 + d10f682 commit 2185deb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
28 changes: 28 additions & 0 deletions docs/MOPIDY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ Configure alsa:

Edit ``/etc/asound.conf``


Two mono zones:

.. code-block:: sh
pcm.output {
Expand All @@ -153,3 +156,28 @@ Edit ``/etc/asound.conf``
}
ttable.0.1 1
}
Mono out (for both left and right):

.. code-block:: sh
pcm.output {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
pcm.mono {
type plug
slave {
pcm "output"
channels 2
}
ttable.0.0 1
ttable.0.1 1
}
6 changes: 3 additions & 3 deletions school_bell/openholidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# absolute imports
import json
import requests
from requests.exceptions import ConnectTimeout
from requests.exceptions import Timeout


__all__ = ['OpenHolidays']
Expand Down Expand Up @@ -399,7 +399,7 @@ def isHoliday(
**kwargs
) -> list:
"""Returns True if the date is either a public or school holiday.
Returns False for any input error or a request.ConnectTimeout.
Returns False for any input error or a timeout.
Parameters
----------
Expand Down Expand Up @@ -449,7 +449,7 @@ def isHoliday(
subdivisionCode=subdivisionCode,
**kwargs
)
except ConnectTimeout:
except (ConnectTimeout, ReadTimeout, Timeout):
return False

holiday = False if not holiday or 'status' in holiday else True
Expand Down
2 changes: 1 addition & 1 deletion school_bell/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def today_is_holiday(subdivisionCode: str):
countryIsoCode=subdivisionCode.split('-')[1],
languageIsoCode=subdivisionCode.split('-')[0],
subdivisionCode=subdivisionCode,
timeout=.5
timeout=30
)


Expand Down

0 comments on commit 2185deb

Please sign in to comment.