From f8055c00447acb6a40b6055952ade0e3a174a448 Mon Sep 17 00:00:00 2001 From: pbr4nzfkh <18879212807@163.com> Date: Sat, 16 Mar 2024 22:15:43 +0800 Subject: [PATCH] restful-request --- 基本结构/042 restful/tf-35-request.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 基本结构/042 restful/tf-35-request.py diff --git a/基本结构/042 restful/tf-35-request.py b/基本结构/042 restful/tf-35-request.py new file mode 100644 index 0000000..235a88e --- /dev/null +++ b/基本结构/042 restful/tf-35-request.py @@ -0,0 +1,10 @@ +import requests +from cppy.cp_util import * + +url = 'http://127.0.0.1:5000/word_frequency' +data_list = extract_file_words(testfilepath) +data = { + 'file': data_list +} +response = requests.post(url, json=data) +print(response.json()[:10])