Answer the question
In order to leave comments, you need to log in
How to make slashes not considered slashes in flask?
My code:
from flask import Flask
import redis, names, random, validators
app = Flask(__name__)
#r = redis.StrictRedis(host='localhost', port=6379, db=0)
#print r.get('foo')
@app.route("/<UrlToSHort>")
def CreateShortLink(UrlToSHort):
if validators.url(UrlToSHort) == True:
ShortedLinkName = names.get_first_name() + str(random.randint(1,130))
r = redis.StrictRedis(host='localhost', port=6379, db=0)
r.set(ShortedLinkName, UrlToSHort)
return r.get(ShortedLinkName)
else:
return "Your link is not !!!"
if __name__ == "__main__":
app.run(debug=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question