{"id":31539773,"url":"https://github.com/mtshaikh/flask-rest-paginate","last_synced_at":"2025-10-04T09:14:41.560Z","repository":{"id":50097664,"uuid":"216995827","full_name":"mtShaikh/flask-rest-paginate","owner":"mtShaikh","description":"Pagination Extension for flask-restful","archived":false,"fork":false,"pushed_at":"2023-10-04T10:24:28.000Z","size":38,"stargazers_count":18,"open_issues_count":4,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-05T04:06:56.915Z","etag":null,"topics":["flask","flask-restful","flask-restplus","pagination","rest-api"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtShaikh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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-10-23T07:32:13.000Z","updated_at":"2024-12-13T23:20:38.000Z","dependencies_parsed_at":"2024-06-20T21:49:15.014Z","dependency_job_id":"3f9e3611-e0cc-4eb5-ac15-b1f008745f3e","html_url":"https://github.com/mtShaikh/flask-rest-paginate","commit_stats":{"total_commits":51,"total_committers":6,"mean_commits":8.5,"dds":0.4117647058823529,"last_synced_commit":"a7525b4286ab19b5b8859c5987907621110bf848"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mtShaikh/flask-rest-paginate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtShaikh%2Fflask-rest-paginate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtShaikh%2Fflask-rest-paginate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtShaikh%2Fflask-rest-paginate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtShaikh%2Fflask-rest-paginate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtShaikh","download_url":"https://codeload.github.com/mtShaikh/flask-rest-paginate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtShaikh%2Fflask-rest-paginate/sbom","scorecard":{"id":666370,"data":{"date":"2025-08-11","repo":{"name":"github.com/mtShaikh/flask-rest-paginate","commit":"a7525b4286ab19b5b8859c5987907621110bf848"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":1,"reason":"Found 3/17 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"12 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2023-62 / GHSA-m2qf-hxjv-5gpq","Warn: Project is vulnerable to: GHSA-cpwx-vrp4-4pq7","Warn: Project is vulnerable to: GHSA-h5c8-rqwp-cp95","Warn: Project is vulnerable to: GHSA-h75v-3vvj-5mfj","Warn: Project is vulnerable to: GHSA-q2x7-8rv6-6q7h","Warn: Project is vulnerable to: GHSA-2g68-c3qc-8985","Warn: Project is vulnerable to: GHSA-f9vj-2wh5-fj8j","Warn: Project is vulnerable to: PYSEC-2023-221 / GHSA-hrfv-mqp8-q5rw","Warn: Project is vulnerable to: PYSEC-2023-57 / GHSA-px8h-6qxv-m22q","Warn: Project is vulnerable to: GHSA-q34m-jh98-gwm2","Warn: Project is vulnerable to: PYSEC-2023-58 / GHSA-xg9f-g7g7-2323","Warn: Project is vulnerable to: PYSEC-2022-203"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T18:09:56.561Z","repository_id":50097664,"created_at":"2025-08-21T18:09:56.561Z","updated_at":"2025-08-21T18:09:56.561Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278290953,"owners_count":25962662,"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-04T02:00:05.491Z","response_time":63,"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":["flask","flask-restful","flask-restplus","pagination","rest-api"],"created_at":"2025-10-04T09:14:39.962Z","updated_at":"2025-10-04T09:14:41.553Z","avatar_url":"https://github.com/mtShaikh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask Rest Paginate\n\nA Pagination Extension for Flask RESTful.\n\n## Installation\n\nInstall the extension using \n```\npip install flask-rest-paginate\n```\n\n## Usage\nIn your app, add the extension as follows\n\n```py\nfrom flask import Flask\nfrom flask_restful import Api\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_rest_paginate import Pagination\n\napp = Flask(__name__)\n\napp.config['SQLALCHEMY_DATABASE_URI'] = \"sqlite:///paginate-test.db\"\ndb = SQLAlchemy(app)\n\npagination = Pagination(app, db)\n\n```\n\nUse in your project as\n```py\npagination.paginate(AuthorModel, author_schema)\n```\n\nYou can also pass the `sqlalchemy` query object as\n```py\npagination.paginate(AuthorModel.query.filter_by(id=author_id), author_schema)\n```\n\nIf you want to use marshmallow schemas then set the third param `True`\n```py\npagination.paginate(AuthorModel, marshamllow_author_schema, True)\n```\n\n## Customize your pagination schema\n\nIf you want create a custom pagination schema. You should pass pagination_schema_hook and return a Dict with you custom schema\n```\nres = pagination.paginate(\n                AuthorModel,\n                schema,\n                True,\n                pagination_schema_hook=lambda current_page, page_obj: {\n                    \"next\": page_obj.has_next,\n                    \"prev\": page_obj.has_prev,\n                    \"current\": current_page,\n                    \"pages\": page_obj.pages,\n                    \"per_page\": page_obj.per_page,\n                    \"total\": page_obj.total,\n                },\n            )\n``` \n\nYou can also customize key names where data and pagination info are placed, setting the configuration variables:\n```\napp.config['PAGINATE_PAGINATION_OBJECT_KEY'] = \"page_info\"\napp.config['PAGINATE_DATA_OBJECT_KEY'] = \"results\"\n\n...\n\n{\n    \"page_info\": {\n        \"currentPage\": 1,\n        \"hasNext\": false,\n        \"hasPrev\": false,\n        \"pages\": 1,\n        \"size\": 20,\n        \"totalElements\": 2\n    }\n    \"results\": {\n        ...\n    }\n}\n```\n\nFurthermore, pagination info can be moved directly to the root of the result object:\n```\napp.config['PAGINATE_PAGINATION_OBJECT_KEY'] = None\napp.config['PAGINATE_DATA_OBJECT_KEY'] = \"results\"\n\n...\n\n{\n    \"currentPage\": 1,\n    \"hasNext\": false,\n    \"hasPrev\": false,\n    \"pages\": 1,\n    \"size\": 20,\n    \"totalElements\": 2\n    \"results\": {\n        ...\n    }\n}\n```\n\n## Example:\n\nCheck the [example](https://github.com/mtShaikh/flask-rest-paginate/tree/master/example) folder for an example of the extension.\n\n## Contributing\n\nWe are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.\n\nYou can report any bug you find or suggest new functionality with a new [issue](https://github.com/mtShaikh/flask-rest-paginate/issues).\n\nIf you want to add yourself some functionality to the extension:\n \n- Open an [issue](https://github.com/mtShaikh/flask-rest-paginate/issues)\n- Comment there you are working on a new functionality\n- Fork the [repo](https://github.com/mtShaikh/flask-rest-paginate/)\n- Create your feature branch (git checkout -b my-new-feature)\n- Commit your changes (git commit -am 'Adds my new feature')\n- Push to the branch (git push origin my-new-feature)\n- Create a new Pull Request\n- mention the issue number in the PR description as `fixes #123, #321`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtshaikh%2Fflask-rest-paginate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtshaikh%2Fflask-rest-paginate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtshaikh%2Fflask-rest-paginate/lists"}