{"id":19789348,"url":"https://github.com/jimmysoda/wikiquote-tweet-awslambda","last_synced_at":"2026-05-15T02:06:50.698Z","repository":{"id":253805507,"uuid":"95598820","full_name":"jimmysoda/wikiquote-tweet-awslambda","owner":"jimmysoda","description":" An AWS Lambda to tweet a random quote from wikiquote.org.","archived":false,"fork":false,"pushed_at":"2017-07-03T18:25:19.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T03:57:25.917Z","etag":null,"topics":["amazon-dash-button","aws","aws-iot","aws-iot-button","aws-iot-python","aws-lambda","pixabay","twitter","wikiquote"],"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/jimmysoda.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":"2017-06-27T20:39:58.000Z","updated_at":"2019-09-16T05:40:13.000Z","dependencies_parsed_at":"2024-08-19T17:29:55.906Z","dependency_job_id":"2c220789-1c72-4afc-9d48-aee791afd15a","html_url":"https://github.com/jimmysoda/wikiquote-tweet-awslambda","commit_stats":null,"previous_names":["jimmysoda/wikiquote-tweet-awslambda"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmysoda%2Fwikiquote-tweet-awslambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmysoda%2Fwikiquote-tweet-awslambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmysoda%2Fwikiquote-tweet-awslambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimmysoda%2Fwikiquote-tweet-awslambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimmysoda","download_url":"https://codeload.github.com/jimmysoda/wikiquote-tweet-awslambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241125390,"owners_count":19913844,"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":["amazon-dash-button","aws","aws-iot","aws-iot-button","aws-iot-python","aws-lambda","pixabay","twitter","wikiquote"],"created_at":"2024-11-12T06:31:23.471Z","updated_at":"2026-05-15T02:06:45.658Z","avatar_url":"https://github.com/jimmysoda.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wikiquote-tweet-awslambda\n An AWS Lambda to tweet a random quote from wikiquote.org and a matching image\n from pixabay.com upon pressing an AWS IoT Button.\n\nSummary\n-------\n\nAn AWS Lambda application written in Python 3.x to tweet a randomly-selected\ninspirational quote from wikiquote.org with a matching image from pixabay.com.\nThe AWS Lambda expects an event in the format sent by the AWS IoT Button.\n\nLearn more about the AWS IoT button, i.e., the programmable Amazon Dash button,\nat https://aws.amazon.com/iotbutton/.\n\nFollow [@asTheQuoteSays](https://twitter.com/asTheQuoteSays) on Twitter for\na demo!\n\nThis code is released using the MIT license. See [LICENSE](LICENSE) for more details.\n\nRequirements\n------------\nThis lambda function retrieves Pixabay and Twitter API keys from environment\nvariables:\n\n- `PIXABAY_KEY`: The Pixabay API key\n- `TWITTER_CONSUMER_KEY`: The Twitter API consumer key\n- `TWITTER_CONSUMER_SECRET`: The Twitter API consumer secret\n- `TWITTER_ACCESS_TOKEN`: The Twitter API access token\n- `TWITTER_ACCESS_SECRET`: The Twitter API access token secret\n\nVisit the [Pixabay API](https://pixabay.com/api/docs/) and [Twitter API](https://apps.twitter.com/) \ndocumentaiton sites for instructions on how to obtain these keys.\n\nSetting the `PHONE_NUMBER` environment variable and allowing `sns:Publish`\nvia [AWS IAM](https://console.aws.amazon.com/iam) for the lambda function\nenables sending a notification SMS with the payload sent by the button\nand the URL to the resulting tweet.\n\nThe following function policy copied from the IoT example lambda functions\nallows limits [AWS SNS](https://console.aws.amazon.com/sns) publish to SMS but not topics or endpoints.\n\n```\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"sns:Publish\"\n            ],\n            \"Resource\": [\n                \"*\"\n            ]\n        },\n        {\n            \"Effect\": \"Deny\",\n            \"Action\": [\n                \"sns:Publish\"\n            ],\n            \"Resource\": [\n                \"arn:aws:sns:*:*:*\"\n            ]\n        }\n    ]\n}\n```\n\nDependencies\n------------\n- Python 3.x: tested on v3.6.1\n- [_requests_ HTTP library](http://docs.python-requests.org/en/master/): tested\n  with v2.18.1\n  or later\n- [_tweepy_ Twitter API wrapper](http://www.tweepy.org/): tested with v3.5.0\n\nThe _requests_ and _tweepy_ libraries need to be uploaded to AWS Lambda in a\n[deployment package](http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html). Remember to install these dependencies\nvia pip [at the root of the package](https://stackoverflow.com/a/40741925) and\nto set the value of the [*Handler* field in AWS Lambda](https://stackoverflow.com/a/35355800)\nto *wikiquote_tweet_awslambda.lambda_handler*.\n\nUsage\n-----\nThe AWS Lambda function (`lambda_handler`) calls the\n`tweet_inspirational_quote` function with a different language depending\non the click type received in the `event` argument:\n\n Click Type | Language | Function Call\n----------- |----------|--------------\n`SINGLE` | English | `tweet_inspirational_quote('en')`\n`DOUBLE` | Spanish | `tweet_inspirational_quote('es')`\n`LONG` | Portuguese | `tweet_inspirational_quote('pt')`\n\nCurrently only English (`en`) and Spanish (`es`) are well tested and supported.\nAny language other than these two and Portuguese (`pt`) is automatically mapped\nto English.\n\nAcknowledgements\n----------------\n- Thanks to @onema for the [lambda-tweet](https://github.com/onema/lambda-tweet)\nAWS Lambda application that I used as a reference on how to use tweepy\n- Thanks to @natetyles for the [wikiquotes-api](https://github.com/natetyler/wikiquotes-api)\nrepository that I used as a reference on how to call the wikiquote.org API and parse\nits response\n- Thanks to @dev-techmoe for the [tweepy status structure gist](https://gist.github.com/dev-techmoe/ef676cdd03ac47ac503e856282077bf2)\nthat I used as a reference to parse the results from tweepy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimmysoda%2Fwikiquote-tweet-awslambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimmysoda%2Fwikiquote-tweet-awslambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimmysoda%2Fwikiquote-tweet-awslambda/lists"}