From 23c3912e8d3d41c7c244d4594fa6bd8b03efc7a7 Mon Sep 17 00:00:00 2001 From: mc Date: Sat, 15 Jun 2019 00:03:01 +0200 Subject: [PATCH 1/3] Adjusted in-skill-purchase samples to support en-GB and de-DE regions where ISPs are now available --- samples/purchase/model.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/purchase/model.py b/samples/purchase/model.py index 957033c..ac6d351 100644 --- a/samples/purchase/model.py +++ b/samples/purchase/model.py @@ -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", @@ -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 = { @@ -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""" @@ -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) From 507c55093af583fbf132615961116b19822208d1 Mon Sep 17 00:00:00 2001 From: "MC51 (Michael)" Date: Mon, 6 Jun 2022 13:40:52 +0200 Subject: [PATCH 2/3] bump cryptography to 3.3.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f6e850d..428cffb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ aniso8601==1.2.0 Flask==1.1.1 -cryptography==2.1.4 +cryptography==3.3.2 pyOpenSSL==17.0.0 PyYAML==5.4 six==1.11.0 From 34227aad30b6b03af7ea4bf71d9c743c1c8be58e Mon Sep 17 00:00:00 2001 From: "MC51 (Michael)" Date: Tue, 7 Jun 2022 19:33:34 +0200 Subject: [PATCH 3/3] downgrade cryptography again because of incompatibility --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 428cffb..f6e850d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ aniso8601==1.2.0 Flask==1.1.1 -cryptography==3.3.2 +cryptography==2.1.4 pyOpenSSL==17.0.0 PyYAML==5.4 six==1.11.0