fail2ban.server.strptime module¶
- fail2ban.server.strptime.getTimePatternRE()¶
- fail2ban.server.strptime.reGroupDictStrptime(found_dict, msec=False, default_tz=None)¶
Return time from dictionary of strptime fields
This is tweaked from python built-in _strptime.
- Parameters:
- found_dictdict
Dictionary where keys represent the strptime fields, and values the respective value.
- default_tzdefault timezone to apply if nothing relevant is in found_dict
(may be a non-fixed one in the future)
- Returns
- ——-
- float
Unix time stamp.
- fail2ban.server.strptime.validateTimeZone(tz)¶
Validate a timezone and convert it to offset if it can (offset-based TZ).
For now this accepts the UTC[+-]hhmm format (UTC has aliases GMT/Z and optional). Additionally it accepts all zone abbreviations mentioned below in TZ_STR. Note that currently this zone abbreviations are offset-based and used fixed offset without automatically DST-switch (if CET used then no automatically CEST-switch).
In the future, it may be extended for named time zones (such as Europe/Paris) present on the system, if a suitable tz library is present (pytz).
- fail2ban.server.strptime.zone2offset(tz, dt)¶
Return the proper offset, in minutes according to given timezone at a given time.
- Parameters:
- tz: symbolic timezone or offset (for now only TZA?([+-]hh:?mm?)? is supported,
- as value are accepted:
int offset; string in form like ‘CET+0100’ or ‘UTC’ or ‘-0400’; tuple (or list) in form (zone name, zone offset);
- dt: datetime instance for offset computation (currently unused)