Skip to content

Commit e589e88

Browse files
committed
Python Time Window Filter
1 parent 0c86360 commit e589e88

File tree

3 files changed

+83
-1
lines changed

3 files changed

+83
-1
lines changed

articles/azure-app-configuration/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@
204204
href: howto-timewindow-filter-aspnet-core.md
205205
- name: JavaScript
206206
href: howto-timewindow-filter-javascript.md
207+
- name: Python
208+
href: howto-timewindow-filter-python.md
207209
- name: Roll out features to targeted audience
208210
items:
209211
- name: Overview
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Enable features on a schedule in a Python application
3+
titleSuffix: Azure App Configuration
4+
description: Learn how to enable feature flags on a schedule in a Python application by using time window filters.
5+
ms.service: azure-app-configuration
6+
ms.devlang: python
7+
author: mrm9084
8+
ms.author: mametcal
9+
ms.topic: how-to
10+
ms.custom: mode-other, devx-track-python
11+
ms.date: 07/09/2025
12+
---
13+
14+
# Enable features on a schedule in a Python application
15+
16+
In this guide, you use the time window filter to enable a feature on a schedule for a Python application.
17+
18+
The example used is based on the Python application introduced in the feature management [quickstart](./quickstart-feature-flag-python.md). Before proceeding further, complete the quickstart to create a Python application with a *Beta* feature flag. Once completed, you must [add a time window filter](./howto-timewindow-filter.md) to the *Beta* feature flag in your App Configuration store.
19+
20+
## Prerequisites
21+
22+
- Create a [Python application with a feature flag](./quickstart-feature-flag-python.md).
23+
- [Add a time window filter to the feature flag](./howto-timewindow-filter.md)
24+
25+
## Use the time window filter
26+
27+
You've added a time window filter for your *Beta* feature flag in the prerequisites. Next, you'll use the feature flag with the time window filter in your Python application.
28+
29+
When you create a feature manager, the built-in feature filters are automatically added to its feature filter collection.
30+
31+
``` python
32+
from featuremanagement import FeatureManager
33+
34+
fm = FeatureManager(provider)
35+
```
36+
37+
## Time window filter in action
38+
39+
When you run the application, the configuration provider loads the *Beta* feature flag from Azure App Configuration. The result of the `is_enabled("Beta")` method will be printed to the console. If your current time is earlier than the start time set for the time window filter, the *Beta* feature flag will be disabled by the time window filter.
40+
41+
You'll see the following console outputs.
42+
43+
``` bash
44+
Beta is enabled: false
45+
Beta is enabled: false
46+
Beta is enabled: false
47+
Beta is enabled: false
48+
Beta is enabled: false
49+
Beta is enabled: false
50+
```
51+
52+
Once the start time has passed, you'll notice that the *Beta* feature flag is enabled by the time window filter.
53+
54+
You'll see the console outputs change as the *Beta* is enabled.
55+
56+
``` bash
57+
Beta is enabled: false
58+
Beta is enabled: false
59+
Beta is enabled: false
60+
Beta is enabled: false
61+
Beta is enabled: false
62+
Beta is enabled: false
63+
Beta is enabled: true
64+
Beta is enabled: true
65+
Beta is enabled: true
66+
Beta is enabled: true
67+
```
68+
69+
If recurrence is enabled when you set up the time window filter, the console outputs will change to `Beta is enabled: false` once your current time passes the end time you set in the time window filter. However, it will change to `Beta is enabled: true` again according to your recurrence settings and continue this pattern until the recurrence expiration time, if set.
70+
71+
## Next steps
72+
73+
To learn more about the feature filters, continue to the following documents.
74+
75+
> [!div class="nextstepaction"]
76+
> [Enable conditional features with feature filters](./howto-feature-filters.md)
77+
78+
> [!div class="nextstepaction"]
79+
> [Roll out features to targeted audience](./howto-targetingfilter.md)

articles/azure-app-configuration/howto-timewindow-filter.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.devlang: csharp
77
author: zhiyuanliang-ms
88
ms.author: zhiyuanliang
99
ms.topic: how-to
10-
ms.date: 10/31/2024
10+
ms.date: 07/08/2025
1111
#customer intent: As an application developer, I want to enable a recurring time window filter in a feature flag so that I can enable or disable features on a schedule.
1212
---
1313

@@ -58,6 +58,7 @@ In this article, you learn how to add and configure a time window filter for you
5858

5959
- [ASP.NET Core](./howto-timewindow-filter-aspnet-core.md)
6060
- [JavaScript](./howto-timewindow-filter-javascript.md)
61+
- [Python](./howto-timewindow-filter-python.md)
6162

6263
## Next steps
6364

0 commit comments

Comments
 (0)