I have a Python script which sends some events on server. Code looks like this:
LOGGER = logging.getLogger("send_event")
POST_EVENT_URL = "http://localhost:3000/event/"
def send(name, data):
url = POST_EVENT_URL + name
headers = {'content-type': 'application/json'}
auth = None
r = requests.post(url, auth=auth, data=json.dumps(data), headers=headers, verify=False)
if (not r.ok) or (200 > r.status_code > 299):
raise IOError(("Failed to upload session to server. OK %s HTTP response code: %d" % (r.ok, r.status_code)))
I need to pass 2 params to this Python function, one will be string(name) and other is json(data) can someone please help me to figure out how to do this using AngularJS 1? Is it possible at all?
Thanks!