master
Aevann1 2021-12-03 18:59:00 +02:00
parent 32b4b93592
commit be23c8887e
1 changed files with 12 additions and 3 deletions

View File

@ -489,11 +489,20 @@ def gumroad(v):
data = { data = {
'access_token': GUMROAD_TOKEN, 'access_token': GUMROAD_TOKEN,
'email': v.email
} }
response = requests.get('https://api.gumroad.com/v2/sales', data=data, timeout=5).json()["sales"]
if len(response) == 0: return {"error": "Email not found"}, 404 response = [x['email'] for x in requests.get('https://api.gumroad.com/v2/products/tfcvri/subscribers', data=data, timeout=5).json()["subscribers"]]
emails = []
for email in response:
if email.endswith("@gmail.com"):
email=email.split('@')[0]
email=email.split('+')[0]
email=email.replace('.','').replace('_','')
email=f"{email}@gmail.com"
emails.append(email)
if v.email not in emails: return {"error": "Email not found"}, 404
response = response[0] response = response[0]
tier = tiers[response["variants_and_quantity"]] tier = tiers[response["variants_and_quantity"]]