Skip to content

Commit 6d51849

Browse files
committed
基本完成
1 parent bee67c8 commit 6d51849

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

api/index.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ class handler(BaseHTTPRequestHandler):
3030

3131
def do_GET(self):
3232
path = self.path
33+
pathreg = re.compile(r'/api?(.*?)')
34+
user = pathreg.findall(path)[0]
35+
data = getdata(user)
3336
self.send_response(200)
34-
self.send_header('Content-type','text/plain')
37+
self.send_header('Content-type','application/json')
3538
self.end_headers()
36-
self.wfile.write(path.encode('utf-8'))
39+
self.wfile.write(json.dumps(data).encode('utf-8'))
3740
return

0 commit comments

Comments
 (0)