Skip to content

Commit be564df

Browse files
committed
fix(pull_live_events): Add example to Unsubscribe PullPoint subscription
1 parent 4fafd8b commit be564df

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

examples/pull_live_events.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
client = ONVIFClient(HOST, PORT, USERNAME, PASSWORD, plugins=[parser])
3030

3131
# 1. Create PullPoint Subscription from Events service
32-
subscription = client.events().CreatePullPointSubscription()
33-
print("Subscription Response:\n", subscription)
32+
subscription_ref = client.events().CreatePullPointSubscription()
33+
print("Subscription Response:\n", subscription_ref)
3434

3535
# 2. Create PullPoint service instance with the Subscription reference
36-
pullpoint = client.pullpoint(subscription)
36+
pullpoint = client.pullpoint(subscription_ref)
3737

3838
# 3. Pull events for 15 minutes
3939
end_time = datetime.datetime.now() + datetime.timedelta(minutes=15)
@@ -123,3 +123,9 @@
123123
# time.sleep(1) # small delay between requests
124124

125125
print("\n✅ Finished: 15 minutes event pulling ended")
126+
127+
# 4. Create Subscription service instance with the Subscription reference
128+
subscription = client.subscription(subscription_ref)
129+
130+
# 5. Unsubscribe to clean up
131+
unsubscribe = subscription.Unsubscribe()

0 commit comments

Comments
 (0)