Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[功能]: 实现医院信息的分页获取 close #37 #38

Merged
merged 2 commits into from
Jan 30, 2020

Conversation

RobertIndie
Copy link
Contributor

API:http://127.0.0.1:9000/wuhan2020/hospitals?skip=${skip}&limit=${limit}

skip: 数据偏移,获取数据跳过的数据条数
limit: 获取的数据条数限制,最大为50

当不使用skip和limit参数时,则返回所有数据。

@rexwangcc rexwangcc self-requested a review January 28, 2020 16:06
resp['success'] = True
except Exception as e:
resp['msg'] = str(e)
return json.dumps(resp, ensure_ascii=False),(400 if not resp['success'] else 200)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid this in some cases will swallow some 500 server errors and make their status codes "look like" 400 errors to API consumers, since the Exception is too broad. We might want to let endpoints throw their errors transparently and have a top-level error handler later. For now, since we don't really care about the error codes, generally I'm OK with this pagination method. What do you think? @LiuChangFreeman

@rexwangcc rexwangcc self-assigned this Jan 29, 2020
Copy link
Contributor

@rexwangcc rexwangcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is pending review for too long, I will go ahead and merge it. We will need to take care of the exception handling later. I have created an issue to record it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants