FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
passkit-python-quickstart/coupons/deleteCampaign.py at develop · PassKit/passkit-python-quickstart · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
PassKit
/
passkit-python-quickstart
Public
Notifications
You must be signed in to change notification settings
Fork
6
Star
7
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
passkit-python-quickstart
/
coupons
/
deleteCampaign.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (24 loc) · 831 Bytes
Breadcrumbs
passkit-python-quickstart
/
coupons
/
deleteCampaign.py
Copy path
File metadata and controls
31 lines (24 loc) · 831 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coupons/deleteCampaign.py
import
grpc
from
passkit
.
io
.
single_use_coupons
import
a_rpc_pb2_grpc
as
coupons_grpc
,
campaign_pb2
def
run
(
channel
:
grpc
.
Channel
,
campaign_id
:
str
)
->
None
:
"""
Delete a coupon campaign by ID.
"""
if
not
campaign_id
:
raise
ValueError
(
"campaign_id is required"
)
stub
=
coupons_grpc
.
SingleUseCouponsStub
(
channel
)
req
=
campaign_pb2
.
CouponCampaign
()
req
.
id
=
campaign_id
stub
.
deleteCouponCampaign
(
req
)
print
(
"Campaign has been deleted:"
,
campaign_id
)
# Optional: standalone test
if
__name__
==
"__main__"
:
from
shared
.
grpcConnectionPooling
import
ChannelPool
TEST_CAMPAIGN_ID
=
""
# set a real campaign id to test
pool
=
ChannelPool
(
size
=
1
)
try
:
ch
=
pool
.
get
()
run
(
ch
,
TEST_CAMPAIGN_ID
)
finally
:
pool
.
close
()
Back
|
FazBrowse Home
|
New Git URL