We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f955a9 commit a038032Copy full SHA for a038032
amazon_paapi/tools/asin.py
@@ -7,12 +7,12 @@
7
def get_asin(text: str) -> str:
8
"""Returns the ASIN from a given text. Raises AsinNotFoundException on fail."""
9
# Return if text is an ASIN
10
- if re.search(r'^[A-Z0-9]{10}$', text):
11
- return text
+ if re.search(r'^[a-zA-Z0-9]{10}$', text):
+ return text.upper()
12
13
# Extract ASIN from URL searching for alphanumeric and 10 digits
14
asin = re.search(r'(dp|gp/product|gp/aw/d|dp/product)/([a-zA-Z0-9]{10})', text)
15
if asin:
16
- return asin.group(2)
+ return asin.group(2).upper()
17
18
raise AsinNotFoundException('Asin not found: ' + text)
0 commit comments