Home > Net >  job() missing 1 required positional argument
job() missing 1 required positional argument

Time:10-25

When i run i get this error every time TypeError: job() missing 1 required positional argument: 'count'

 count = 0
    @app.route('/v1.1/userRegistor', methods=['POST', 'GET'])
    def job(count):
        
        
        data = request.get_json()
        numbers = data['number']
    if count == 0:
        api2_url = f'https://app.simplywhatsapp.com/api/send.php?number={numbers}&type=text&message=Your OTP is  {value}&instance_id=api2&access_token=api2'
        r = requests.get(api2_url).text
        count  = 1

CodePudding user response:

Your @app.route does not define a count parameter to be provided, yet your job() function requires a parameter.

For a path parameter for example you could define count in the route by:

@app.route('/v1.1/userRegistor/<count>', methods=['POST', 'GET'])

CodePudding user response:

The error says your URL needs the count argument so maybe something like:

@app.route('/v1.1/userRegistor/<count>', methods=['POST', 'GET'])

See the suggested answers here

  • Related