-
Notifications
You must be signed in to change notification settings - Fork 0
Dev #19
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
Dev #19
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -367,8 +367,6 @@ async def download_file(file_name: str): | |
| ) | ||
|
|
||
|
|
||
| # --- 其他原有路由 (保持不变) --- | ||
|
|
||
| @app.get("/v1/{timestamp}") | ||
| async def read_root(timestamp: float): | ||
| """ | ||
|
|
@@ -493,12 +491,6 @@ async def rank(searchTime: str): | |
| return cached_result | ||
|
|
||
| client = get_jm_client() | ||
| pages: jmcomic.JmCategoryPage = client.categories_filter( | ||
| page=1, | ||
| time=jmcomic.JmMagicConstants.TIME_ALL, | ||
| category=jmcomic.JmMagicConstants.CATEGORY_ALL, | ||
| order_by=jmcomic.JmMagicConstants.ORDER_BY_LATEST, | ||
| ) | ||
| if searchTime == "month": | ||
| pages: jmcomic.JmCategoryPage = client.month_ranking(1) | ||
| elif searchTime == "week": | ||
|
Comment on lines
491
to
496
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lack of Error Handling and ValidationThe function Recommendation:
|
||
|
|
@@ -515,5 +507,4 @@ async def rank(searchTime: str): | |
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| # 确保 uvicorn 运行时引用的是当前文件的 app 实例 | ||
| uvicorn.run("main:app", host="0.0.0.0", log_level="info") | ||
|
Comment on lines
509
to
510
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Security Concern: Server ExposureThe application is configured to listen on all network interfaces ( Recommendation: |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improvement in Error Messaging
The error handling in lines [367-372] could be enhanced by providing more specific error messages based on the type of error encountered (e.g., file not found, access denied, etc.). Currently, the generic message 'File not found or has expired.' does not give enough information about what went wrong, which can hinder troubleshooting and user experience.
Recommendation:
Enhance the error handling by catching specific exceptions and returning more descriptive error messages. This will help in diagnosing issues more effectively and improve the clarity of communication to the end-user.