1

I have a nodejs server setup on AWS with mongoDB. I want to access the database contents using GET method. There is another application in python which needs to access this database present on AWS. I searched on the internet and came across PycURL but I am not getting how to use it exactly. How to approach with pycURL or what can be an alternate solution?

Tanay Narkhede
  • 355
  • 3
  • 19

2 Answers2

0

You can build your restful API that is going to handle those GET requests. You have awesome tutorial (with example that you want on bottom):

https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4


Edit: If you want phyton code for GET requests there is awesome answer here: Simple URL GET/POST function in Python


Edit 2: Example of how would this work. You first need to code your API how to handle GET request and on what route (example: http://localhost:5000/api/getUsers). Than you want to make GET request to that route using Phyton: Example:

r = requests.get(url="http://localhost:5000/api/getUsers")
Community
  • 1
  • 1
  • Actually our server is working. we have another application having python scripts and that application needs accessing the database. So how do i acess the database from that application (code in python) – Tanay Narkhede Feb 26 '17 at 07:25
  • @TanayNarkhede You have awesome answer written in phyton here: http://stackoverflow.com/questions/4476373/simple-url-get-post-function-in-python – someRandomSerbianGuy Feb 26 '17 at 07:27
0

I had a similar problem a while ago, there is a tutorial here here. It can lead you towards your intended direction, the drawback may be that in the tutorial, to issue the http request (if I remember correctly), they used postman but I'm sure you can still use PyCurl.