How to use send_file method in autotest

Best Python code snippet using autotest_python

flask_client.py

Source: flask_client.py Github

copy

Full Screen

2app = Flask(__name__)3@app.route('/​index')4def index():5 # 首页6 return send_file('templates/​index.html')7@app.route('/​video')8def video():9 # 电影10 return send_file('templates/​video.html')11@app.route('/​movies/​classification/​')12def classification():13 # 电影分类14 return send_file('templates/​classification.html')15@app.route('/​<username>/​home/​history')16def history(username):17 # 历史记录18 return send_file('templates/​html/​history.html')19@app.route('/​top100/​')20def top100():21 return send_file('templates/​top100.html')22@app.route('/​top100/​<cursor>')23def pager_top100(cursor):24 return send_file('templates/​top100.html')25@app.route('/​login')26def login():27 # 登录28 return send_file('templates/​login.html')29@app.route('/​register')30def register():31 # 注册32 return send_file('templates/​register.html')33@app.route('/​<username>/​home/​profile')34def profile(username):35 # 个人中心36 return send_file('templates/​html/​profile.html')37@app.route('/​<username>/​home/​video')38def my_video(username):39 # 个人中心40 return send_file('templates/​html/​myvideo.html')41@app.route('/​<username>/​home/​fans')42def fans(username):43 # 个人中心44 return send_file('templates/​html/​fans.html')45@app.route('/​<username>/​home/​attention')46def attention(username):47 # 个人中心48 return send_file('templates/​html/​attention.html')49@app.route('/​<username>/​movies/​release')50def video_release(username):51 # 上传视频52 return send_file('templates/​release.html')53@app.route('/​<username>/​space')54def space(username):55 # 个人空间56 return send_file('templates/​space.html')57@app.route('/​<username>/​attention')58def attention_user(username):59 # 关注的用户60 return send_file('templates/​attention_user.html')61@app.route('/​<username>/​fans')62def fans_user(username):63 # 关注ta的用户64 return send_file('templates/​fans_user.html')65@app.route('/​movie/​<int:m_id>')66def movies_detail(m_id):67 # 电影详情页68 return send_file('templates/​detail.html')69@app.route('/​movie/​player/​<int:m_id>')70def player(m_id):71 # 电影播放页72 return send_file('templates/​player.html')73@app.route('/​movie/​shortplayer/​<int:m_id>')74def shortplayer(m_id):75 # 电影播放页76 return send_file('templates/​shortplayer.html')77@app.route('/​404')78def error():79 # error80 return send_file('templates/​html/​pages-error-404.html')81if __name__ == '__main__':...

Full Screen

Full Screen

app.py

Source: app.py Github

copy

Full Screen

...9def redirindex():10 return redirect("http:/​/​93.12.72.173/​cv",code=302)11@app.route('/​cv/​assets/​img/​elie_ntumba.jpg')12def elie_ntumba_jpg():13 return send_file("assets/​img/​elie_ntumba.jpg", mimetype="image/​jpg")14@app.route('/​cv/​Facebook.png')15def fb_png():16 return send_file("assets/​img/​Facebook.png", mimetype='image/​png')17@app.route('/​cv/​assets/​css/​animated.min.css')18def animated_css():19 return send_file("assets/​css/​animated.min.css", mimetype='text/​css')20@app.route('/​cv/​assets/​css/​materialize.min.css')21def materialize_css():22 return send_file("assets/​css/​materialize.min.css", mimetype='text/​css')23@app.route('/​background1.jpg')24def back1_jpg():25 return send_file("assets/​img/​background1.jpg", mimetype='text/​jpg')26@app.route('/​background2.jpg')27def back2_jpg():28 return send_file("assets/​img/​background2.jpg", mimetype='text/​jpg')29@app.route('/​background3.jpg')30def back3_jpg():31 return send_file("assets/​img/​background3.jpg", mimetype='text/​jpg')32@app.route('/​js/​materialize.js')33def materialize_js():34 return send_file("assets/​js/​materialize.min.js", mimetype='text/​js')35@app.route('/​js/​init.js')36def materialize_init():37 return send_file("assets/​js/​init.js", mimetype='text/​js')38@app.route('/​cv/​logo_PC.png')39def logo_png():40 return send_file("logo_PC.png", mimetype='image/​png')41@app.route('/​cv/​assets/​css/​style.css')42def style_css():43 return send_file("assets/​css/​style.css", mimetype='text/​css')44@app.route('/​cv/​assets/​img/​instagram.png')45def instagram_png():46 return send_file("assets/​img/​instagram.png", mimetype='image/​png')47@app.route('/​cv/​assets/​img/​Elie_Intro1.jpg')48def elie_png():49 return send_file("assets/​img/​Elie_Intro1.jpg", mimetype='image/​jpg')50@app.route('/​cv/​assets/​img/​linkedin.png')51def linkedin_png():52 return send_file("assets/​img/​linkedin.png", mimetype='image/​png')53@app.route('/​cv/​logo_PC.ico')54def logo_pc_ico():55 return send_file("logo_PC.ico", mimetype='image/​x-icon')56if __name__ == '__main__' :...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

How To Use Playwright For Web Scraping with Python

In today’s data-driven world, the ability to access and analyze large amounts of data can give researchers, businesses & organizations a competitive edge. One of the most important & free sources of this data is the Internet, which can be accessed and mined through web scraping.

Fluent Interface Design Pattern in Automation Testing

Recently, I was going through some of the design patterns in Java by reading the book Head First Design Patterns by Eric Freeman, Elisabeth Robson, Bert Bates, and Kathy Sierra.

Introducing LambdaTest Analytics: Test Reporting Made Awesome ????

Collecting and examining data from multiple sources can be a tedious process. The digital world is constantly evolving. To stay competitive in this fast-paced environment, businesses must frequently test their products and services. While it’s easy to collect raw data from multiple sources, it’s far more complex to interpret it properly.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful