Skip to content

Adjusted in-skill-purchase samples to support all regions where ISP is available #252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions samples/purchase/model.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import requests
from flask import json
from flask_ask import logger
from flask_ask import logger, context, request

class Product():
'''
Object model for inSkillProducts and methods to access products.

{"inSkillProducts":[
{"productId":"amzn1.adg.product.your_product_id",
"referenceName":"product_name",
Expand All @@ -26,10 +26,10 @@ def __init__(self, apiAccessToken):

def query(self):
# Information required to invoke the API is available in the session
apiEndpoint = "https://api.amazonalexa.com"
apiEndpoint = context.System.apiEndpoint
apiPath = "/v1/users/~current/skills/~current/inSkillProducts"
token = "bearer " + self.token
language = "en-US" #self.event.request.locale
language = request.locale

url = apiEndpoint + apiPath
headers = {
Expand All @@ -46,7 +46,7 @@ def query(self):
data = json.loads(res.text)
return data['inSkillProducts']
else:
return None
return None

def list(self):
""" return list of purchasable and not entitled products"""
Expand All @@ -59,11 +59,11 @@ def list(self):
def purchasable(self, product):
""" return True if purchasable product"""
return 'PURCHASABLE' == product['purchasable']

def entitled(self, product):
""" return True if entitled product"""
return 'ENTITLED' == product['entitled']


def productId(self, name):
print(self.product_list)
Expand Down