-1

Currently I have a angularjs file which uses $http.get to call my python flask script.

In this flask script I want to then call another python script (which is running pySolr), however the http.get call contains a parameter I wish to pass to this pySolr script.

Is there any documentation on this/ can it actually be done?

$http.get('http://localhost:5000/python/solr', "$scope.tag");
console.log($scope.tag);

$scope.tag is the variable I need to get

My flask file is as follows:

from flask import Flask
app = Flask(__name__)

@app.route('/python/solr')
def solr():
    "MY CODE TO CALL SOLR SCRIPT GOES HERE"


if __name__ == "__main__":
app.run()
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
McCourt2364
  • 61
  • 13

1 Answers1

2

You should be able to do this using query parameters:

$http.get('http://localhost:5000/python/solr?tag=' + $scope.tag);
console.log($scope.tag);

In flask

from flask import request

@app.route('/python/solr')
def solr():
    print request.args  # should get tag here
Eric Conner
  • 10,422
  • 6
  • 51
  • 67