I am making Snap! Extensions Made Using Python, and I am working on cloud vars. Here is my current code: https://replit.com/@joecooldoo/Snap-Extensions when I try to get the value of a var, it just return a 404 (Not using replit, it is on the server website that is created). I also need a way to access it in Snap! as well.
I think a better title for the thread might help...
How is that?
I would have said "my Python cloud var server" so we understand that it's a web server you're talking about.
Fixed.
Quick glance- you don't seem to have initialised your variable db
Yes, dictionary must be initialised.
Method definitions must be aligned to the left.
"[ ]" are obsolete.
db={}
...
@app.route('/get/<name>')
def gt(name):
value=db[name]
return value
@cymplecy and @dardoro, thanks! I tried dardoro's solution but it only fixed set. I read the docs, but they weren't very helpful. And this is my VERY FIRST EVER python program, so that is why I am kind of a noob.
Did you look at the link I posted that shows how to import the module to handle databases?
If your more familiar with JavaScript, maybe use a node.js server solution instead?
I don't Darek's is the right solution in this case
I couldnt quite understand it
Hmm, I thought I did that already...
Have you removed the suggestion that Darek made yet?
Hmm, it still not working
aah - your currently trying to return [value] rather than just value
Try this
IT WORKS!
Let me solution
One more question:
I want to be able to get the value in Snap!