Advertisement
Guest User

Untitled

a guest
Mar 9th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. from flask import Flask, request, send_from_directory, jsonify
  2. app = Flask(__name__, static_url_path='')
  3.  
  4. @app.route('/test/json', methods=['POST'])
  5. def testJSON():
  6. content = request.get_json(silent=False, force=True)
  7. specifiedUsername = content['username']
  8. specifiedPassword = content['password']
  9.  
  10. print "User specified the password: " + specifiedPassword
  11. print "user specified the username: " + specifiedUsername
  12.  
  13. if specifiedUsername == "Administrator":
  14. if specifiedPassword == "Password123":
  15. return jsonify({"message": "Login Successfull"})
  16. else:
  17. return jsonify({"message": "Login Failed"})
  18. else:
  19. return jsonify({"message": "Login Failed"})
  20. return jsonify({"message": "oops... Looks like something has gone wrong"})
  21.  
  22. @app.route('/auth/login', methods=['POST'])
  23. def authenticationLogin():
  24. return "Not yet implemented"
  25.  
  26. @app.route('/auth/register', methods=['POST'])
  27. def authenticationRegister():
  28. return "Not yet implemented"
  29.  
  30. @app.route('/auth/recover', methods=['POST'])
  31. def authenticationRecover():
  32. return "Not yet implemented"
  33.  
  34. @app.route('/download/request', methods=['POST'])
  35. def downloadRequest():
  36. return "Functionality to allow the user to request a download from youtube"
  37.  
  38. @app.route('/tracks/getAll', methods=['POST'])
  39. def tracksGetAll():
  40. return "Not yet implemented"
  41.  
  42. @app.route('/tracks/getTrack', methods=['POST'])
  43. def tracksGetTrack():
  44. return "Not yet implemented"
  45.  
  46. @app.route('/tags/getForTrack', methods=['POST'])
  47. def tagsGetForTrack():
  48. return "Not yet implemented"
  49.  
  50. @app.route('/tags/updateForTrack', methods=['POST'])
  51. def tagsUpdateForTrack():
  52. return "Not yet implemented"
  53.  
  54. @app.route('/playlist/getAll', methods=['POST'])
  55. def playlistGetAll():
  56. return "Not yet implemented"
  57.  
  58. @app.route('/playlist/getList', methods=['POST'])
  59. def playlistGetList():
  60. return "Not yet implemented"
  61.  
  62. @app.route('/playlist/deleteList', methods=['POST'])
  63. def playlistDeleteList():
  64. return "Not yet implemented"
  65.  
  66. @app.route('/playlist/addTrack', methods=['POST'])
  67. def playlistAddTrack():
  68. return "Not yet implemented"
  69.  
  70. @app.route('/playlist/deleteTrack', methods=['POST'])
  71. def playlistDeleteTrack():
  72. return "Not yet implemented"
  73.  
  74. @app.route('/user/add', methods=['POST'])
  75. def userAdd():
  76. return "Not yet implemented"
  77.  
  78. @app.route('/user/update', methods=['POST'])
  79. def userUpdate():
  80. return "Not yet implemented"
  81.  
  82. @app.route('/user/delete', methods=['POST'])
  83. def userDelete():
  84. return "Not yet implemented"
  85.  
  86. @app.route('/user/get', methods=['POST'])
  87. def userGet():
  88. return "Not yet implemented"
  89.  
  90. @app.route('/user/getList', methods=['POST'])
  91. def userGetList():
  92. return "Not yet implemented"
  93.  
  94.  
  95. if __name__ == "__main__":
  96. app.run(host= '0.0.0.0', port= 8000, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement