Skip to content

Instantly share code, notes, and snippets.

@JWDT
Last active January 8, 2019 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JWDT/75c8c80b845e947819b80394b0b4a0fc to your computer and use it in GitHub Desktop.
Save JWDT/75c8c80b845e947819b80394b0b4a0fc to your computer and use it in GitHub Desktop.
Simple example of a find and replace function for Google Cloud Functions integrated with Integromat. https://medium.com/@jwdt/using-python-with-integromat-865d4efb2a77
def find_and_replace(request):
try:
old_string = request.args.get('string')
text_to_find = request.args.get('old')
text_to_replace = request.args.get('new')
except:
# If there are any errors at this stage...
# assume it's because of bad input.
return ('', 400)
try:
return old_string.replace(text_to_find, text_to_replace)
except:
# If there's an error here, it's possibly our fault.
return ('', 500)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment