{"id":26120615,"url":"https://github.com/fulfilio/flask-shopify","last_synced_at":"2025-04-13T12:10:30.881Z","repository":{"id":57430728,"uuid":"109085211","full_name":"fulfilio/flask-shopify","owner":"fulfilio","description":"Flask Shopify Extension to write shopify apps faster","archived":false,"fork":false,"pushed_at":"2019-08-06T21:07:52.000Z","size":4,"stargazers_count":22,"open_issues_count":2,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-05T22:12:40.568Z","etag":null,"topics":["flask","shopify"],"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/fulfilio.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}},"created_at":"2017-11-01T04:02:12.000Z","updated_at":"2023-09-25T00:44:42.000Z","dependencies_parsed_at":"2022-09-13T15:20:47.623Z","dependency_job_id":null,"html_url":"https://github.com/fulfilio/flask-shopify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulfilio%2Fflask-shopify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulfilio%2Fflask-shopify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulfilio%2Fflask-shopify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulfilio%2Fflask-shopify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fulfilio","download_url":"https://codeload.github.com/fulfilio/flask-shopify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710445,"owners_count":21149190,"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","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","shopify"],"created_at":"2025-03-10T13:43:27.234Z","updated_at":"2025-04-13T12:10:30.861Z","avatar_url":"https://github.com/fulfilio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Installation\n\n`pip install flask-shopify`\n\n## Settings/Config\n\nThe API Key and shared secret should be set on the config of\nthe app\n\n```\nSHOPIFY_SHARED_SECRET   = Your app's shared secret key with Shopify.\nSHOPIFY_API_KEY         = Your app's API key.\n```\n\n## Example usage\n\n### Setup the app\n\n```\nfrom flask_shopify import Shopify\n\napp = Flask(__name__)\nshopify = Shopify(app)\n```\n\nor, if you are using the factory pattern\n\n```\nfrom flask_shopify import Shopify\n\nshopify = Shopify()\n\n# ...\n# when app is available\n\nshoify.init_app(app)\n```\n\n### Using `shopify_login_required` decorator\n\nThe decorator allows protecting handles with a shopify session.\n\nBefore you can use the decorator, ensure that a login view is\nconfigured. This is where fulfil will redirect the user is there\nis no login session yet.\n\n```\n# Set the login view if you plan on using shopify_login_required\n# decorator\nshopify.login_view = 'auth.login'\n```\n\nUsing decorator\n\n```\nfrom flask_shopify import shopify_login_required\n\n@shopify_login_required\n@app.route('/product')\ndef product():\n    product = shopify.Product.find(\n        request.args['id']\n    )\n```\n\n### When using admin links\n\nIf you are using admin links, then shopify launches the url\nwith the shop in the parameters. You can use the `assert_shop`\ndecorator to ensure that the current shop the user is logged\ninto is also the shop where the user clicked the admin link.\n\n```\nfrom flask_shopify import shopify_login_required, assert_shop\n\n@shopify_login_required\n@assert_shop\n@app.route('/product')\ndef product():\n    product = shopify.Product.find(\n        request.args['id']\n    )\n```\n\n\n### Login, logout and oauth authentication\n\nBuilt-in helpers achieve all of this.\n\n#### Login\n\n```\n@app.route('/login')\ndef login():\n    shop = request.args.get('shop')\n    if shop:\n        return shopify.install(\n            shop,\n            ['write_products'],\n            url_for('.authenticate', _external=True)\n        )\n    return render_template('select-shop.html')\n```\n\n#### Authenticate after Oauth dance\n\n```\n@app.route('/authenticate')\ndef authenticate():\n    shopify_session = shopify.authenticate()\n    if shopify_session:\n        return redirect(\n            session.pop('next_url', url_for('.index'))\n        )\n    return \"Login Failed\"\n```\n\n#### Logout\n\n```\n@app.route('/logout')\ndef logout():\n    shopify.logout()\n    return redirect('home')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulfilio%2Fflask-shopify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffulfilio%2Fflask-shopify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulfilio%2Fflask-shopify/lists"}