forked from pinterest/api-quickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoauth_scope.py
More file actions
88 lines (78 loc) · 3.35 KB
/
oauth_scope.py
File metadata and controls
88 lines (78 loc) · 3.35 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from enum import Enum
# Enumerate the valid OAuth scopes.
# For details, see:
# https://developers.pinterest.com/docs/redoc/#section/User-Authorization/OAuth-scopes
class Scope(Enum):
# granular scopes
READ_DOMAINS = "read_domains"
READ_BOARDS = "read_boards"
WRITE_BOARDS = "write_boards"
READ_PINS = "read_pins"
WRITE_PINS = "write_pins"
READ_USERS = "read_users"
WRITE_USERS = "write_users"
READ_SECRET_BOARDS = "read_secret_boards"
READ_SECRET_PINS = "read_secret_pins"
READ_USER_FOLLOWERS = "read_user_followers"
WRITE_USER_FOLLOWEES = "write_user_followees"
READ_ADVERTISERS = "read_advertisers"
WRITE_ADVERTISERS = "write_advertisers"
READ_CAMPAIGNS = "read_campaigns"
WRITE_CAMPAIGNS = "write_campaigns"
READ_MERCHANTS = "read_merchants"
WRITE_MERCHANTS = "write_merchants"
READ_PIN_PROMOTIONS = "read_pin_promotions"
WRITE_PIN_PROMOTIONS = "write_pin_promotions"
# composite scopes
READ_ORGANIC = "read_organic"
WRITE_ORGANIC = "write_organic"
MANAGE_ORGANIC = "manage_organic"
READ_SECRET = "read_secret"
READ_ADS = "read_ads"
WRITE_ADS = "write_ads"
MANAGE_MERCHANTS = "manage_merchants"
def lookup_scope(key):
if key == "help":
print_scopes()
exit(0)
try:
return Scope[key.upper()]
except KeyError:
print("Invalid scope:", key)
print_scopes()
exit(1)
def print_scopes():
print(
"""\
Valid OAuth 2.0 scopes for Pinterest API version v3:
read_domains Get your website's most clicked Pins, see top saved Pins, etc.
read_boards See all your boards (including secret and group boards)
write_boards Create new boards and change board settings
read_pins See all public Pins and comments
write_pins Create new Pins
read_users See public data about a user (including boards, following, profile)
write_users Change a user's following information
read_secret_boards See secret boards
read_secret_pins See secret pins
read_user_followers Access a user's follows and followers
write_user_followees Follow things for a user
read_advertisers See a user's advertising profile and settings
write_advertisers Create and manage a user's advertising profile
read_campaigns See data on ad campaigns, including spend, budget and performance
write_campaigns Create and manage ad campaigns
read_merchants See a user's Catalog (shopping feed)
write_merchants Manage a user's Catalog (shopping feed)
read_pin_promotions See ads and ad creatives
write_pin_promotions Create and manage ads and ad creatives
Composite scopes...
read_organic See all of a user's public data.
write_organic Create new Pins and boards, update public data
manage_organic See, update, and add to public data
read_secret See secret boards and secret Pins
read_ads See data on ad campaigns, including spend, budget and performance
write_ads Manage ad campaigns and see data including spend, budget and performance
manage_merchants See and manage a user's Catalog (shopping feed)
For more information, see:
https://developers.pinterest.com/docs/redoc/#section/User-Authorization/OAuth-scopes\
""" # noqa: E501 because the long lines in the message are okay
)