In case
$.get('http://localhost:5000/api/scan').success(function(res) {
//your code
}});
you request scan, but if you add "?who=Masha" you send a parameter who with a value "Masha" as get request parameter.
$.get('http://localhost:5000/api/scan?who=Masha').success(function(res) {
//your code
}});
Then if your python get response (typically def do_GET(self):
) has:
data['channel'] = urlparse.parse_qs(urlparse.urlparse(self.path).query).get('who', None)
Note that you need to import urlparse (In Python3, you'd use urllib.parse)
import urlparse
From w3schools
The GET Method
Note that the query string (name/value pairs) is sent
in the URL of a GET request:
/test/demo_form.asp?name1=value1&name2=value2
Some other notes on GET requests:
- GET requests can be cached
- GET requests remain in the browser history
- GET requests can be bookmarked
- GET requests should never be used when dealing with sensitive data
- GET requests have length restrictions
- GET requests should be used only to retrieve data