{"id":17294763,"url":"https://github.com/machinecyc/flask-web-api","last_synced_at":"2026-05-15T22:05:26.584Z","repository":{"id":122134890,"uuid":"204249923","full_name":"machineCYC/Flask-Web-API","owner":"machineCYC","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-22T22:29:01.000Z","size":7,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T19:47:27.741Z","etag":null,"topics":["api","flask","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/machineCYC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-25T05:21:55.000Z","updated_at":"2020-06-14T05:35:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b86ec8f-7bd5-426b-8485-6e641e2fc1a4","html_url":"https://github.com/machineCYC/Flask-Web-API","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/machineCYC/Flask-Web-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machineCYC%2FFlask-Web-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machineCYC%2FFlask-Web-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machineCYC%2FFlask-Web-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machineCYC%2FFlask-Web-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/machineCYC","download_url":"https://codeload.github.com/machineCYC/Flask-Web-API/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machineCYC%2FFlask-Web-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009488,"owners_count":26084609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","flask","python3"],"created_at":"2024-10-15T11:07:54.655Z","updated_at":"2025-10-12T00:19:55.457Z","avatar_url":"https://github.com/machineCYC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask-Web-API\n\n## Environment\n\n- windows 8\n- python 3.6\n- Visual Studio Code\n- Libray 請參考 requirements.txt\n\n## Summary\n\n透過 Flask 快速搭建一個簡單的 web api\n\n利用 FinMind 所提供的股價資料庫來建立 api，避免使用者直接對 DB 撈資料\n\n讓 user 只要輸入資料名稱、股價代碼、時間即可獲取該資料\n\n最後再透過 test.py 來測試 api 是否符合需求\n\n## RESTful API\n\nHTTP 協定中，定義了多種不同的 method 做為服務的請求方法，常見如下五種:\n\n    GET: 取得服務的資料或是狀態。（safe \u0026 idempotent）\n    POST: 將原先沒有的資料去做一筆新增的動作\n    PUT: 利用更新的方式於\"指定位置\"新增一項資料，像是複製檔案貼上。 （idempotent）\n    PATCH: 在現有的資料欄位中，增加或部分更新一筆新的資料，就是一般常見的修改。\n    DELETE: 指定資料刪除。 （idempotent）\n\n- safe: 該操作不會改變原本的資源狀態，並且同樣的結果是可以被快取（Cache）的，EX: 訂單查詢\n- idempotent: 該操作不管做1遍、2遍或多遍，都會得到同樣的資源狀態結果\n- POST/PUT 都可以用來新增\n- PATCH/PUT 都可以用來修改\n\n在 Http 的協定下，每一種呼叫方式都會有一種他專屬的特殊定義，也就是說不同的方法就是對同一件事情做不同的操作。\n\n像是在開發 API 時，會透過一個 url 來進行讀取資料或上傳資料，而可以理解成每一個 url 是一個專屬服務的窗口\n\n**在開發 API 時沒有一定要照著上面的定義敘述建立，但如果你符合的話，你可以將它稱作 Restful API**\n\nREST 全名 Resource Representational State Transfer ，可譯為具象狀態傳輸，若是把各個單字拆開來解釋的話即如下：\n\n- Resource：資源\n- Representational：表現形式，如 JSON，XML ...\n- State Transfer：狀態變化。即上述講到的可利用 HTTP 動詞們來做呼叫\n\nREST 指的是網路中 Client 端和 Server 端的一種呼叫服務形式，透過既定的規則，滿足約束條件和原則的應用程式設計，對資源的操作包括獲取、創建、修改和刪除資源，這些操作就是依照我們前面所提到的 HTTP Method: GET、POST、PUT、PATCH和DELETE。這正好會對應到資料庫基本操作 CRUD。\n\nCRUD 為 Create(新增)、Read(讀取)、Update(更新)與Delete(刪除)的縮寫。\n\n\n## Swagger API 規範\n\nSwagger 是由 Reverb technologies 公司，所開的 API 規範， 在 2015 年度被貢獻給 OpenAPI 成為標準規範\n\n專案使用到 API 通常都要建立文件，透過 Swagger API 的方式可以快速建立文件，讓使用者清楚且快速地了解接受到的資料格式\n\n## Reference\n\n- [輕鬆學習 Python：使用 Flask 創建 Web API](https://medium.com/datainpoint/flask-web-api-quickstart-3b13d96cccc2)\n\n- [REST APIs with Flask 系列教學文 [1]](https://medium.com/@twilightlau94/rest-apis-with-flask-%E7%B3%BB%E5%88%97%E6%95%99%E5%AD%B8%E6%96%87-1-5405216d3166)\n\n- [寫给新手看的 Flask+uwsgi+Nginx+Ubuntu 部署教程](https://knarfeh.com/2016/06/11/%E5%86%99%E7%BB%99%E6%96%B0%E6%89%8B%E7%9C%8B%E7%9A%84Flask+uwsgi+Nginx+Ubuntu%E9%83%A8%E7%BD%B2%E6%95%99%E7%A8%8B/?fbclid=IwAR0jsMX4qDhMBpyj3H84Xfc6tIJre12179Kgc1EFlfzcnpAL2zeo7GunK_c)\n\n- [[不是工程師] 休息(REST)式架構? 寧靜式(RESTful)的Web API是現在的潮流？](https://progressbar.tw/posts/53)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachinecyc%2Fflask-web-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmachinecyc%2Fflask-web-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachinecyc%2Fflask-web-api/lists"}