forked from zhangyu19/dupPRdetect
修复一些redis的小问题
This commit is contained in:
parent
8cd48f5000
commit
2f6f56e11a
2
app.py
2
app.py
|
@ -120,4 +120,4 @@ def output():
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
app.run(host="localhost", debug=True)
|
app.run(host="0.0.0.0", debug=True)
|
|
@ -1,3 +1,4 @@
|
||||||
|
from re import T
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import jieba
|
import jieba
|
||||||
|
@ -10,7 +11,7 @@ import math
|
||||||
import redis
|
import redis
|
||||||
|
|
||||||
token = ""
|
token = ""
|
||||||
r = redis.StrictRedis(host="localhost", port=6379, db=0)
|
r = redis.StrictRedis(host="localhost", port=6379, db=0, decode_responses=True)
|
||||||
|
|
||||||
def crawl_api(url):
|
def crawl_api(url):
|
||||||
header = {"Authorization": "token %s" % token}
|
header = {"Authorization": "token %s" % token}
|
||||||
|
@ -73,6 +74,7 @@ def crawl_all_pr(url):
|
||||||
|
|
||||||
|
|
||||||
def detect_text_file_dup(all_pr_info, project_key, pr_num):
|
def detect_text_file_dup(all_pr_info, project_key, pr_num):
|
||||||
|
print(r.get(project_key + "_" + str(pr_num)))
|
||||||
current_pr_value = json.loads(r.get(project_key + "_" + str(pr_num)))
|
current_pr_value = json.loads(r.get(project_key + "_" + str(pr_num)))
|
||||||
current_word = jieba.lcut(current_pr_value["title"] + " " + current_pr_value['description'])
|
current_word = jieba.lcut(current_pr_value["title"] + " " + current_pr_value['description'])
|
||||||
current_word = [x.strip() for x in current_word if x.strip() != '']
|
current_word = [x.strip() for x in current_word if x.strip() != '']
|
||||||
|
@ -165,6 +167,7 @@ def main(repo, pr_num, url_head):
|
||||||
file = extract_filename(file_info) # 解析title
|
file = extract_filename(file_info) # 解析title
|
||||||
|
|
||||||
value = {"title": title, "description": description, "file": file}
|
value = {"title": title, "description": description, "file": file}
|
||||||
|
|
||||||
r.set(project_pr_key, json.dumps(value)) # 将需要缓存的数据写入redis数据库
|
r.set(project_pr_key, json.dumps(value)) # 将需要缓存的数据写入redis数据库
|
||||||
else:
|
else:
|
||||||
pass # 跳过,下一步直接获取缓存数据
|
pass # 跳过,下一步直接获取缓存数据
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<!--Just the logo.. Don't mind this-->
|
<!--Just the logo.. Don't mind this-->
|
||||||
<div>
|
<div>
|
||||||
<form class="bs-example bs-example-form" style="width: 600px;" role="form"
|
<form class="bs-example bs-example-form" style="width: 600px;" role="form"
|
||||||
action="http://localhost:5000/result" method="POST" name="input_url">
|
action="http://106.75.189.31:5000/result" method="POST" name="input_url">
|
||||||
<div class="input-group input-group-lg">
|
<div class="input-group input-group-lg">
|
||||||
<span class="input-group-addon" style="margin: 20px;"> PR URL </span>
|
<span class="input-group-addon" style="margin: 20px;"> PR URL </span>
|
||||||
<input type="text" class="form-control" placeholder="URL of Source Pull Request" name="SrcPR"
|
<input type="text" class="form-control" placeholder="URL of Source Pull Request" name="SrcPR"
|
||||||
|
|
Loading…
Reference in New Issue