Skip to content

Instantly share code, notes, and snippets.

@thiagomgo
Created November 1, 2016 19:13
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save thiagomgo/7f738b8d89a537ba1aa4d97d90b17c28 to your computer and use it in GitHub Desktop.
Save thiagomgo/7f738b8d89a537ba1aa4d97d90b17c28 to your computer and use it in GitHub Desktop.
A simple lambda function written in python to execute a curl command
def lambda_handler(event, context):
import subprocess
result = subprocess.call("curl -I http://foo.bar", shell=True)
return result
@yasser583
Copy link

it shows me a zero (0) when I get the result at the other side

@colu75
Copy link

colu75 commented Feb 8, 2019

it shows me a zero (0) when I get the result at the other side

Hi, I have the same issue, did you figure out whats happend?

Thanks in advance

@HansonVPHAM
Copy link

Hi, I have the same issue. Did you figure out the workaround?

Thank you.

@pwilken
Copy link

pwilken commented Apr 12, 2019

0 => success

"returncode: Exit status of the child process. Typically, an exit status of 0 indicates that it ran successfully."
=> https://docs.python.org/3/library/subprocess.html

@JafarShaik01
Copy link

Hi,

im getting error
/bin/sh: curl: command not found.

any suggestions ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment