faas-and-furious / youtube-dl

Download YouTube videos as a function
27 stars 19 forks source link

Can't make a request in python #6

Closed MikhailAmeerally closed 5 years ago

MikhailAmeerally commented 5 years ago

Would like to call this function inside of another function so that I can process the new file elsewhere. I am currently using python3 requests library to do this (but it's not working)

def handle(req): """handle a request to the function Args: req (str): request body """ arg = req

WHERE ARG IS THE URL I WANT TO PROCESS

r = requests.get("http://gateway:8080/function/hello-openfaas", data=arg)
#ALSO TRIED
# r = requests.get("http://gateway:8080/function/hello-openfaas", data=arg)
print(r.text)
return req

Expected Behaviour

Expect to get back the binary that is printed out when run on the command line.

Current Behaviour

Currently I am getting an error cannot connect, connection refused error from python. So, it's not to do with openFaas, but more how to contact the openFaas function using requests.

Possible Solution

Update readMe.md?

Steps to Reproduce (for bugs)

copy and paste code? It's a pretty simple "bug"

Context

Need to have a function call this one to get the encoding for the video, saved into that r variable, so that I can save it into a mov file, so that I can process the mov file in another function.

alexellis commented 5 years ago

Hi thank you for your interest, please can you create a GitHub repo with all the code you are using and then seek out technical support on Slack? Thank you

alexellis commented 5 years ago

https://slack.openfaas.io