File fetching from cloud

#1

I have a file in git repository,

and i want to map that file in python function node,

Can someone help me with this?

0 Likes

#2

I think that would be:

/home/vcap/app/get_ticket.py
0 Likes

#3

If you are using Node-RED on bluemix or any other cloud environment it’s useful to state that in your post.

0 Likes

#4

Yes I'm on Node-RED on bluemix

0 Likes

#5

Thank you nick it really did work but i get this error message,

image

Here is the script in that file,


import requests
import json

requests.packages.urllib3.disable_warnings()

apic_em_ip = "https://sandboxapicem.cisco.com/api/v1/ticket"

def get_token(url):

#Payload contains authentication information
payload = { "username": "******", "password": "*********" }

#Header information
headers = {"content-type" : "application/json"}

#Combine URL, API call and parameters variables
response = requests.post(url, data=json.dumps(payload), headers=headers).json()

# Return authentication token from respond body
return response["response"]["serviceTicket"]

def main():

#Assign obtained authentication token to a variable. Provide APIC-EM's URL address
auth_token = get_token(apic_em_ip)
print("\n")		
print("Service Ticket:", auth_token)

if name == "main":
main()


How can i install the REQUEST module to bluemix in order to run that python script

0 Likes

#6

You cannot easily do that. The application is a node.js app and the buildpack that creates it only knows how to do things with node. There is no mechanism for installing extra python modules.

But you really should be doing such a straightforward http request using the HTTP Request node in a flow.

0 Likes

#7

I'm doing all these alternate approach is because of SSL handshake error arised in HTTP Request node

0 Likes

#8

Hello Nick, we tried the same by deploying node-red from our local environment rather using cloud environment and the script was executed successfully without the Request module being installed.

0 Likes