#๐ Aiosqlite
52 messages ยท Page 1 of 1 (latest)
@primal sparrow
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
!paste
use this
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
Thanks
where is the problem
In the route /completed its not commiting
any errors?
@primal sparrow one of these are probably not working
are the else statements running?
No errors just dosnt commit
Yes they are.
which is which
though i can guess
(None,) is result
and the key isnt in there
do data.fetchall() maybe?
@primal sparrow โฌ๏ธ
But thing is i dont need key for updating credits
why are you doing if key in result then
Thats for verifying witch is usless to db not commiting
The credits
is it returning "Invalid Key"?
so key is not in result because await data.fetchone() is returning a None
The credits
yeah the commit is inside the if key in result
If theres no credits in the db it adds a credit has nuin to do with key
key is not in result so it is not running the code to commit
key needs to be in result
or commit wont happen
you have this here but it is never running because it never reaches inside of the if
you need to put that in the else
and then commit
@primal sparrow do you understand what im talking about?
Oh so i should put like a defualt var?
keyStore = []
@app.route("/completed/<id>/<key>")
async def complete(id, key):
async with aiosqlite.connect("main.db") as db:
async with db.cursor() as cursor:
data = await cursor.execute(f"SELECT auth FROM linkvertise WHERE id = {id}")
result = await data.fetchone()
if key in result:
keyStore.append(key)
if request.referrer and "linkvertise.com" in request.referrer:
response = "Added +1 credits to your balance"
data = await cursor.execute(f"SELECT credits FROM linkvertise WHERE id = {id}")
result = await data.fetchone()
await cursor.execute("UPDATE linkvertise SET credits = credits + 1 WHERE id = ?;", (id, ))
await db.commit()
return response
else:
response = "Bypass detected"
return response
else:
await cursor.execute("INSERT INTO linkvertise (id, credits) VALUES (?,?);", (id, 1))
await db.commit()
return "something"
```something like this i believe
idk if i completely understood
but that it what i was talking about]
The else: needs to return invalid key not add a credits
u need a valid key to get a credits
????
If the key and headers are true it adds a credit else it returns invalid key
Its not commiting in the headers area
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.