Skip to content

Instantly share code, notes, and snippets.

@SalocinDotTEN
Created July 17, 2017 01:52
Show Gist options
  • Save SalocinDotTEN/264c5c77f0f41dbe0e61a4e9f73916af to your computer and use it in GitHub Desktop.
Save SalocinDotTEN/264c5c77f0f41dbe0e61a4e9f73916af to your computer and use it in GitHub Desktop.
Mnemonic generator post micro service AWS Lambda code. Result should come back as JSON.
#It requires some packages. Please pip install them first.
import string
import requests
import re
import urllib
from bs4 import BeautifulSoup
def main(event,context):
#Put into the words parameter the acronym with each letter separated by a single space.
r = requests.post('http://www.mnemonicgenerator.com/', data = {'words' : ' '})
returnhtml = BeautifulSoup(r.text, 'html.parser')
return {
'acronym': returnhtml.h2.text
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment