Created
April 24, 2022 17:57
-
-
Save souravs17031999/291dcbb6ee5f350674a5a8579707b56e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_amazon_product_response(): | |
apiParams = { | |
'api_key': AMAZON_API_KEY, | |
'type': 'product', | |
'amazon_domain': 'amazon.in', | |
'asin': 'B093L8FSP2', | |
'output': 'json' | |
} | |
headers = {"Content-Type": "application/json"} | |
print(f"[AMAZON]: Trying for product ID {AMAZON_PRODUCT_ID_ASIN}") | |
try: | |
print(f"[REQUEST]: GET {AMAZON_PRODUCT_API} {apiParams}") | |
product_get_response = requests.get( | |
AMAZON_PRODUCT_API, | |
headers=headers, | |
params=apiParams | |
) | |
print(f"[RESPONSE]: {product_get_response.status_code}") | |
json_product_response = product_get_response.json() | |
# print(json_product_response) | |
except Exception as e: | |
print(f"[ERROR]: {e}") | |
print( | |
"status: failure, message: Failure in sending request to Amazon Server !" | |
) | |
return json_product_response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment