Question: please assingment. = hangul_client.py 1 #coding: utf-8 2 import requests 3 4 base = 'http://127.0.0.1:7000/ 5 6 r1 = requests.get(base + 'hangul') 7 print(ri) 8

please assingment. = hangul_client.py 1 #coding: utf-8 2 import requests 3 4base = 'http://127.0.0.1:7000/ 5 6 r1 = requests.get(base + 'hangul') 7 print(ri)8 print(r1.json() 9 10 data_form = { 'character': 'test', 'freq':0} 11 r2please assingment.

= hangul_client.py 1 #coding: utf-8 2 import requests 3 4 base = 'http://127.0.0.1:7000/ 5 6 r1 = requests.get(base + 'hangul') 7 print(ri) 8 print(r1.json() 9 10 data_form = { 'character': 'test', 'freq':0} 11 r2 = requests.post(base + 'hangul', data=data_form) 12 print(r2) 13 print(r2.json() 15 data_form { 'character': 'test', 'freq':1} 16 r3 = requests.put(base + 'hangul', data=data_form) 17 print(r3) 18 print(r3.json()) 19 20 data_form { character': 'test'} 21 r4 requests.delete(base + 'hangul', data=data_form) 22 print(r4) 23 print(r4.json()) 14 ( jek@jek-VirtualBox:-/cs4ks/flask_service$ python3 hangul_client.py [['O', 300763], ['L', 217722], ['F', 200092], ['7', 170995], ['2', 153356], ['1', 142723], ['-', 117620], ['e', 105415], ['1', 99588], ['*', 93830), (';', 83541], ['1', 82628], ['E! 81179], ['T', 76587], ['o', 72456], ['H', 59454], ['H', 52177], ['1', 50681], ['|', 48121 ], ['t', 29046], ['4', 25404], ['u', 19862], ['a', 17603], ['TT', 16400], ['E', 15095], ['- 11151], [u', 11103], [', 10010], ['T', 7152], ['a', 5339], ['T', 5154], ['11, 4766), ['|', 4153], ['a', 4149], ['F', 4148], ['18', 1534], ['a', 1467], ['21', 1271], [', 1266], ['B', 849], ['#', 696], ['a', 329], ['', 304], ['a', 90], ['2', 49], ['u', 37], ('', 3 s], ['a', 6], ['a', 4], ['2', 1), ('. 258], '0', 9), (, 3, ('A' 3], ['test, oj] ['test', 'e', 'error in insert'] ['1', 'test', sucess in update'] ['test', 'sucess in delete'] Assignment Quiz Why POST request has an error in insert though the response code is success(200)? 30 hangulFlask.py - 27 lines: coding: utf-8- 28 @app.route('/hangul', methods = ['POST', 'PUT', 'DELETE ']) 29 def updates(): conn = connect_db() 31 cur = conn.cursor() 32 #reuest to creat an entry item 33 if request.method == 'POST': 34 #print(request.args) 35 try: 36 letter_fields = (request.form['character'), request.form['freq']) print('POST', letter_fields) 38 sql = ''tnsert into han_letters (character, freq) values (?, ?)' 39 cur.execute(sql, (letter_fields)) conn.commit() 41 conn.close() letter_fields += ('sucess in insert',) 43 return jsonify(letter_fields) except Exception as e: print(e) letter_fields += ('error in insert',) return jsonify(letter_fields) Wwwwwww 37 40 42 44 45 46 47 40

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!