I have two apps, a flask app(app.py) as my interface, and another app that integrates with a usb barcode scanner and sends a post request to the Flask route, lets call this scanner app (scanner.py).
What I wanted to happen is that when the scanner successfully scans a barcode, supposedly it should have sent a post reqeusts to the route with a payload, and the payload should have been received by the flask app.
But I think this is incorrect since nothing happens after the scan.
scanner.py
def UPC_lookup(api_key,upc):
    '''V3 API'''
    try:
        item, value = search_request(upc)
        print str(item) + ' - ' + str(value)
        payload = {}
        payload['item'] = str(item)
        payload['price'] = str(value)
        payload_data = json.dumps(payload)
        requests.post('http://localhost:5000/', data=payload_data)
    except Exception as e:
        pass
if __name__ == '__main__':
    try:
        while True:
            UPC_lookup(api_key,barcode_reader())
    except KeyboardInterrupt:
        pass
app.py
# Index route
@app.route("/", methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        item = request.args.get('item')
        price = request.args.get('price')
        print(str(item))
        print(str(price))
        return render_template('dashboard.html', item=item, value=price)
    return render_template('dashboard.html') #ICO Details
What I wanted to happen is that when it scans a barcode and sends a post request, the payload should have been received and is shown to the dashboard, however im receiving nothing.
Is there a workaround for this? or perhaps a much better implementation?
 
    