Last active
January 8, 2019 13:53
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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