Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. url='ptenantectdtest.blob.core.windows.net/documentcontainer/0bbc072c-9114-4ff5-9bc7-dbcc86bff54d?sv=2015-12-11&sr=b&sig=0gqc0l8csgO82dTV5NnTidrQV570YwrVOofN4ZSxSo4%3D&st=2019-07-20T12%3A51%3A12Z&se=2019-07-21T13%3A01%3A12Z&sp=r&rscd=attachment%3B%20filename%3D%20%225ca21af9-5b67-45f8-969c-ae571431c665.pdf%22'
  2.  
  3. code(unsuccessful attempt):-
  4. '''python
  5. from flask import Flask
  6. from flask import send_file
  7. app = Flask(__name__)
  8.  
  9. @app.route('/', defaults={'path': ''})
  10. @app.route('/<path:path>')
  11. def downloadFile(path):
  12. if path is None:
  13. self.Error(400)
  14. try:
  15. return send_file(path, as_attachment=True)
  16. except Exception as e:
  17. self.log.exception(e)
  18. self.Error(400)
  19.  
  20. if __name__ == '__main__':
  21. app.run(debug=False)
  22.  
  23. from flask import Flask
  24. from flask import send_file
  25. app = Flask(__name__)
  26.  
  27. @app.route('/download')
  28. def downloadFile ():
  29.  
  30. path = 'ptenantectdtest.blob.core.windows.net/documentcontainer/7d9843fd-0a92-4fbc-aa73-06aa074ca26b?sv=2015-12-11&sr=b&sig=TwA4zEdKWGpZO7hzI9FYjn07S8aN0wCOyQUkzCS5x5Y%3D&st=2019-07-18T18%3A18%3A43Z&se=2019-07-19T18%3A28%3A43Z&sp=r&rscd=attachment%3B%20filename%3D%20%22f4d50a94-580e-4093-b8fd-0a6a78b3b1e6.pdf%22'
  31. return send_file(path, as_attachment=True)
  32.  
  33. if __name__ == '__main__':
  34. app.run(debug=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement