{"id":20483972,"url":"https://github.com/hammady/qusasat","last_synced_at":"2025-10-15T03:40:10.841Z","repository":{"id":40280854,"uuid":"216087318","full_name":"hammady/qusasat","owner":"hammady","description":"Web app, tweet-poster and Telegram bot to show a random qusasa (quote) from renowned author Dr. Ahmed Khalid Tawfik. Telegram channel: https://t.me/qusasataktowfik","archived":false,"fork":false,"pushed_at":"2024-05-18T16:25:38.000Z","size":1033,"stargazers_count":3,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T14:43:47.038Z","etag":null,"topics":["docker","flask","heroku","herokuapp","python","python-3","quotes","render","telegram","telegram-bot","telegram-bot-api","twitter","twitter-api","twitter-bot"],"latest_commit_sha":null,"homepage":"https://djm02nc015.execute-api.us-east-1.amazonaws.com/","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/hammady.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-18T18:45:23.000Z","updated_at":"2024-05-26T02:18:34.000Z","dependencies_parsed_at":"2024-05-18T16:31:24.241Z","dependency_job_id":null,"html_url":"https://github.com/hammady/qusasat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hammady/qusasat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hammady%2Fqusasat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hammady%2Fqusasat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hammady%2Fqusasat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hammady%2Fqusasat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hammady","download_url":"https://codeload.github.com/hammady/qusasat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hammady%2Fqusasat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279043722,"owners_count":26091528,"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-15T02:00:07.814Z","response_time":56,"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":["docker","flask","heroku","herokuapp","python","python-3","quotes","render","telegram","telegram-bot","telegram-bot-api","twitter","twitter-api","twitter-bot"],"created_at":"2024-11-15T16:19:23.424Z","updated_at":"2025-10-15T03:40:10.801Z","avatar_url":"https://github.com/hammady.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qusasat\n\n[![HerokuDeploy](https://github.com/hammady/qusasat/actions/workflows/main.yml/badge.svg)](https://github.com/hammady/qusasat/actions/workflows/main.yml)\n\nA web app to show a random qusasa (quote) from the book entitled:\nQuotes worth burning (قصاصات قابلة للحرق) for the renowned author\n[Dr. Ahmed Khalid Tawfik](https://en.wikipedia.org/wiki/Ahmed_Khaled_Tawfik).\n\nIncluded is a script (`tweet_poster.py`) that automatically posts a tweet with a random quote.\n\n## System requirements\n1. [Docker](https://docs.docker.com/install/)\n2. There is no number 2!\n\n## Development\n\n### Build\n\n```bash\ndocker build . -f dev.dockerfile -t qusasat:dev\n```\n\n### Run the web app\n\n```bash\ndocker run -it --rm -p 5000:5000 -v $PWD:/home qusasat:dev\n```\n\nThen point your browsear to \n[http://localhost:5000](http://localhost:5000) to get a random quote.\nThe following routes are available:\n- [/](http://localhost:5000/): Return a random quote\n- [/.json](http://localhost:5000/.json): Return a random quote in JSON format\n- [/\\\u003cid\\\u003e](http://localhost:5000/1): Return a specific quote by its ID\n- [/\\\u003cid\\\u003e.json](http://localhost:5000/1.json): Return a specific quote by its ID in JSON format\n\nNote that in development mode, editing and saving any file will\nrefresh the development server automatically and you can refresh\nthe browser to get your updates.\n\n## Production\n\n### Build\n\n```bash\ndocker build . -t qusasat:prod\n```\n\n### Run the web app\n\n```bash\ndocker run -it --rm -p 5000:5000 qusasat:prod\n```\n\n### Heroku support\nThe app supports [Heroku](https://www.heroku.com/) out of the box.\nFollow the instructions [here](https://devcenter.heroku.com/articles/container-registry-and-runtime)\nto deploy this web app using Heroku Container Registry.\nAnother way, is to deploy by pushing the `master` branch to the `heroku` remote\nafter configuring it. This is the standard and recommended way.\n\n## Posting tweets\n\nRun the `tweet_poster.py` script after providing some environment variables:\n\n```bash\ndocker run -it --rm --env-file .env qusasat:prod python tweet_poster.py\n```\n\nWhere `.env` contains the following twitter tokens:\n\n```\nTWITTER_CONSUMER_KEY=???\nTWITTER_CONSUMER_SECRET=???\nTWITTER_ACCESS_KEY=???\nTWITTER_ACCESS_SECRET=???\n```\n\nIf you want to do a dry run (just print the tweets without posting them),\nadd an environment variable to the `.env` file:\n```\nDRY_RUN=1\n```\nThis is useful if you want to see how long tweets will be splitted into\nmultiple tweets in a thread.\n\nOn Heroku, you can supply those tokens using app\n[config vars](https://devcenter.heroku.com/articles/config-vars).\nTo automatically send scheduled tweets, provision the\n[Heroku Scheduler](https://devcenter.heroku.com/articles/scheduler) add-on,\nand set its command to: `python tweet_poster.py`.\n\n## Sending on Telegram\n\nThe app can send quotes to a Telegram channel. To do so, you need to\ncreate a Telegram bot and channel, and get the bot token and the channel ID.\nThen, provide the following environment variables:\n\n```\nTELEGRAM_CHAT_ID=???\nTELEGRAM_BOT_TOKEN=???\nMESSAGES_SIGNATURE=???\n```\n\nThen, run the `telegram_sender.py` script:\n\n```bash\ndocker run -it --rm --env-file .env qusasat:prod python telegram_sender.py\n```\n\nMessage signatures are optional and can be used to add a signature to the end of\neach message.\n\nTo generate a token for the bot and identify the channel id, check the\nofficial docs for [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API).\n\n## Deploy using AWS Lambda\n\nA Github Action is provided to deploy the app to AWS Lambda.\nIt is triggered on push to the `master` branch.\nTo deploy manually do the following:\n\n- Install node 19\n- Install Serverless framework: `npm install -g serverless`\n- Install dependencies: `npm install`\n- Configure AWS credentials: `aws configure`\n- Deploy the app:\n\n    ```bash\n    TELEGRAM_BOT_TOKEN=\u003cbot_token\u003e \\\n    TELEGRAM_CHAT_ID=\u003cchat_id\u003e \\\n    MESSAGES_SIGNATURE=\u003csignature\u003e \\\n    sls deploy --aws-profile \u003cprofile_name\u003e --stage prod\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhammady%2Fqusasat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhammady%2Fqusasat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhammady%2Fqusasat/lists"}