Cloud Computing Course
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
3.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. # Library_Auto_Seats_Pick
  2. ##### For Cloud Computing Course
  3. 19级 杨浩然
  4. ------
  5. 助教老师:
  6. ​ UCLOUD云主机镜像名称为Library_Auto_Seats_Pick,ID为uimage-2yzhlk2p,请您检查。谢谢!
  7. ​ 云主机用户名、密码如下:
  8. ###### root
  9. ###### Glitzyi299
  10. ```shell
  11. cd /autobook/
  12. nohup ./run.py >/dev/null 2>&1 &
  13. ```
  14. ​ 另:该程序偶尔出现bug,若出现无法抢得座位的情况,可能是暂时无座位释放,或者selenium对元素的交互失败等原因。可以移步我的demo文件夹查看演示视频。再次感谢!
  15. ### Background
  16. The end of each semester could always evoke the students' enthusiasm for learning, while the library resources of Zhongbei campus are quite worse than Minhang campus, which means there is more competition for seats. And this might cause some students can't reserve a seat for several days.
  17. This project aims to provide automatic seat-grab solutions for students with low screen time, raising the efficiency of seats grabbing.
  18. ### Install
  19. - ##### This project uses Python, Flask, Chrome and Chromedrvier. Go check them out if you don't have them locally installed.
  20. - **Install Flask**
  21. Open a terminal, make a new folder to store the project. Let's call this folder **autobook**.
  22. If you are using Python 3.6, enter **autobook** and create a virtual environment.
  23. ```shell
  24. python3 -m venv flask
  25. ```
  26. Type these commands one by one to install Flask and its extension.
  27. ```shell
  28. flask/bin/pip install flask
  29. flask/bin/pip install flask-login
  30. flask/bin/pip install flask-openid
  31. flask/bin/pip install flask-mail
  32. flask/bin/pip install flask-sqlalchemy
  33. flask/bin/pip install sqlalchemy-migrate
  34. flask/bin/pip install flask-whooshalchemy
  35. flask/bin/pip install flask-wtf
  36. flask/bin/pip install flask-babel
  37. flask/bin/pip install guess_language
  38. flask/bin/pip install flipflop
  39. flask/bin/pip install coverage
  40. ```
  41. - **Install Chrome**
  42. ```shell
  43. yum -y install google-chrome-stable
  44. ```
  45. - **Install Chromedriver**
  46. The version of Chromedriver should be consistent with your Chrome's. If you don't know your Chrome's version, try to type this command to check out.
  47. ```shell
  48. google-chrome --version
  49. ```
  50. Go to this address to find a matching version of Chrome.
  51. http://chromedriver.storage.googleapis.com/index.html
  52. You could download the .zip file to your PC, transfer to your cloud host via Xftp or something else, and unzip it later.
  53. Or you might use this command.
  54. ```shell
  55. wget https://npm.taobao.org/mirrors/chromedriver/83.0.4103.14/chromedriver_linux64.zip
  56. unzip chromedriver_linux64.zip
  57. ```
  58. Just to make sure everything goes well, you might as well type this to avoid possible permission problem.
  59. ```shell
  60. chmod a+x chromedriver
  61. ```
  62. - **Other necessary Python modules**
  63. Use Pip to install some essential modules.
  64. ```shell
  65. pip3 install pyvirtualdisplay
  66. pip3 install selenium
  67. pip3 install PyEmail
  68. pip3 install gevent
  69. ```
  70. ### Usage
  71. - ##### Deploy
  72. Determine run.py as an executable file.
  73. ```shell
  74. chmod a+x run.py
  75. ```
  76. Run as follows.
  77. ```shell
  78. ./run.py
  79. ```
  80. - ##### Customer use
  81. Visit the website:
  82. http://127.0.0.1:5000/
  83. ![login page](http://gitea.shuishan.net.cn/10195501441/Library_Auto_Seats_Pick/src/branch/master/img-folder/login.png)
  84. ![success page](http://gitea.shuishan.net.cn/10195501441/Library_Auto_Seats_Pick/src/branch/master/img-folder/success.png)
  85. ### Maintainers
  86. [@Young Hojan](http://gitea.shuishan.net.cn/10195501441)
  87. ### License
  88. [MIT](http://gitea.shuishan.net.cn/10195501441/Library_Auto_Seats_Pick/src/branch/master/LICENSE.md) © Young Hojan