I passing a request from python to flask. I am not able to access the requests which are being sent from python in flask. Here is my python function -
import requests
dice_roll = 1
dealear_roll = 2
url = 'http://127.0.0.1:5000/dice'
data = {'dice_roll':dice_roll,'dealear_roll':dealear_roll}
r = requests.post(url=url,data=data)
Here is flask api
from flask import Flask, render_template
import random
from flask import request
app = Flask(__name__)
@app.route('/dice')
def dice_roll():
dice_roll = request.args.get('dice_roll')
dealear_roll = request.args.get('dealear_roll')
print('dice_roll',dice_roll)
print('dealear_roll',dealear_roll)
if __name__ == '__main__':
app.run(debug=True)
I am not able to access the requests in flask. Can anyone tell where am i doing wrong?