Skip to main content
added 1600 characters in body
Source Link
ShwSvn
  • 79
  • 3
  • 8
      Traceback (most recent call last):
  File "C:/Users/dnTTT/PycharmProjects/crypt/testapiconnect\Python27\lib\site-packages\flask\app.py", line 131997, in <module>__call__
    printreturn requestsself.getwsgi_app('httpenviron, start_response)
  File "C://127\Python27\lib\site-packages\flask\app.0py", line 1985, in wsgi_app
    response = self.0handle_exception(e)
  File "C:\Python27\lib\site-packages\flask\app.1py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:5000/getdata'\Python27\lib\site-packages\flask\app.py", auth=HTTPBasicAuthline 1982, in wsgi_app
    response = self.full_dispatch_request('user')
  File "C:\Python27\lib\site-packages\flask\app.py", 'password'line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Python27\lib\site-packages\flask\app.jsonpy", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Python27\lib\site-packages\requests\modelspackages\flask\app.py", line 8661598, in jsondispatch_request
    return complexjsonself.loadsview_functions[rule.endpoint](self**req.textview_args)
  File "C:\Python27\webapi\venv\webapi.py", **kwargsline 59, in get_data
    cnx = mysql.connector.connect(**config)
  File "C:\Python27\lib\json\__init__\Python27\lib\site-packages\mysql\connector\__init__.py", line 339179, in loadsconnect
    return _default_decoder.decodeMySQLConnection(s*args, **kwargs)
  File "C:\Python27\lib\json\decoder\Python27\lib\site-packages\mysql\connector\connection.py", line 36498, in decode__init__
    objself.close()
  File "C:\Python27\lib\site-packages\mysql\connector\connection.py", endline =252, in close
    self.raw_decodecmd_quit(s)
  File "C:\Python27\lib\site-packages\mysql\connector\connection.py", idx=_wline 581, in cmd_quit
    self._socket.send(spacket, 0, 0)
  File "C:\Python27\lib\site-packages\mysql\connector\network.endpy", line 143, in send_plain
    errno=2055, values=(self.get_address(), _strioerror(err)))
  File "C:\Python27\lib\json\decoder\Python27\lib\site-packages\mysql\connector\errors.py", line 382185, in raw_decode__init__
    raise ValueError("No JSONself.msg object= couldself.msg be% decoded")values
ValueErrorUnicodeDecodeError: No'ascii' JSONcodec objectcan't coulddecode bebyte decoded0xe3 in position 46: ordinal not in range(128)

But know I'm gettingSorry for the long error, I didin't knew if you need it all so I send like this one

I had de program working with sqlite3 but I needed to use mysql so to get all the data on the web api and the other program getting the data to an array and it's not working now

    Traceback (most recent call last):
  File "C:/Users/dnTTT/PycharmProjects/crypt/testapiconnect.py", line 13, in <module>
    print requests.get('http://127.0.0.1:5000/getdata', auth=HTTPBasicAuth('user', 'password')).json()
  File "C:\Python27\lib\site-packages\requests\models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

But know I'm getting this one

      Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\flask\app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Python27\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Python27\webapi\venv\webapi.py", line 59, in get_data
    cnx = mysql.connector.connect(**config)
  File "C:\Python27\lib\site-packages\mysql\connector\__init__.py", line 179, in connect
    return MySQLConnection(*args, **kwargs)
  File "C:\Python27\lib\site-packages\mysql\connector\connection.py", line 98, in __init__
    self.close()
  File "C:\Python27\lib\site-packages\mysql\connector\connection.py", line 252, in close
    self.cmd_quit()
  File "C:\Python27\lib\site-packages\mysql\connector\connection.py", line 581, in cmd_quit
    self._socket.send(packet, 0, 0)
  File "C:\Python27\lib\site-packages\mysql\connector\network.py", line 143, in send_plain
    errno=2055, values=(self.get_address(), _strioerror(err)))
  File "C:\Python27\lib\site-packages\mysql\connector\errors.py", line 185, in __init__
    self.msg = self.msg % values
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 46: ordinal not in range(128)

Sorry for the long error, I didin't knew if you need it all so I send like this

I had de program working with sqlite3 but I needed to use mysql so to get all the data on the web api and the other program getting the data to an array and it's not working now

deleted 3 characters in body
Source Link
ShwSvn
  • 79
  • 3
  • 8

I would like help in just one thing

@app.route('/getdata', methods =['GET', 'POST'])
#@requires_auth
def get_data():

    config = {
        'user': 'user',
        'password': 'password.',
        'host': '127.0.0.1',
        'database': 'database',
        'raise_on_warnings': True,
        'use_pure': False,
    }

    cnx = mysql.connector.connect(**config)

    cur = cnx.cursor()

    cur.execute("SELECT hash FROM hash_files")


     rows = cur.fetchall()
     response = [row['hash'][row[0] for row in rows]

    return jsonify(response)
   

    cnx.close()

I get this error "tuple indices must be integers, not str" can someone help me please?

I got that error before, but now I have this one

    Traceback (most recent call last):
  File "C:/Users/dnTTT/PycharmProjects/crypt/testapiconnect.py", line 13, in <module>
    print requests.get('http://127.0.0.1:5000/getdata', auth=HTTPBasicAuth('user', 'password')).json()
  File "C:\Python27\lib\site-packages\requests\models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

But know I'm getting this one

I would like help in just one thing

@app.route('/getdata', methods =['GET', 'POST'])
#@requires_auth
def get_data():

    config = {
        'user': 'user',
        'password': 'password.',
        'host': '127.0.0.1',
        'database': 'database',
        'raise_on_warnings': True,
        'use_pure': False,
    }

    cnx = mysql.connector.connect(**config)

    cur = cnx.cursor()

    cur.execute("SELECT hash FROM hash_files")


    rows = cur.fetchall()
    response = [row['hash'] for row in rows]

    return jsonify(response)
   

    cnx.close()

I get this error "tuple indices must be integers, not str" can someone help me please?

I got that error before, but now I have this one

    Traceback (most recent call last):
  File "C:/Users/dnTTT/PycharmProjects/crypt/testapiconnect.py", line 13, in <module>
    print requests.get('http://127.0.0.1:5000/getdata', auth=HTTPBasicAuth('user', 'password')).json()
  File "C:\Python27\lib\site-packages\requests\models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

But know I'm getting this one

I would like help in just one thing

@app.route('/getdata', methods =['GET', 'POST'])
#@requires_auth
def get_data():

    config = {
        'user': 'user',
        'password': 'password.',
        'host': '127.0.0.1',
        'database': 'database',
        'raise_on_warnings': True,
        'use_pure': False,
    }

    cnx = mysql.connector.connect(**config)

    cur = cnx.cursor()

    cur.execute("SELECT hash FROM hash_files")


     rows = cur.fetchall()
     response = [row[0] for row in rows]

    return jsonify(response)
   

    cnx.close()

I get this error "tuple indices must be integers, not str" can someone help me please?

I got that error before, but now I have this one

    Traceback (most recent call last):
  File "C:/Users/dnTTT/PycharmProjects/crypt/testapiconnect.py", line 13, in <module>
    print requests.get('http://127.0.0.1:5000/getdata', auth=HTTPBasicAuth('user', 'password')).json()
  File "C:\Python27\lib\site-packages\requests\models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

But know I'm getting this one

added 884 characters in body
Source Link
ShwSvn
  • 79
  • 3
  • 8

I would like help in just one thing

@app.route('/getdata', methods =['GET', 'POST'])
#@requires_auth
def get_data():

    config = {
        'user': 'user',
        'password': 'password.',
        'host': '127.0.0.1',
        'database': 'database',
        'raise_on_warnings': True,
        'use_pure': False,
    }

    cnx = mysql.connector.connect(**config)

    cur = cnx.cursor()

    cur.execute("SELECT hash FROM hash_files")


    rows = cur.fetchall()
    response = [row['hash'] for row in rows]

    return jsonify(response)
   

    cnx.close()

I get this error "tuple indices must be integers, not str" can someone help me please?

I got that error before, but now I have this one

    Traceback (most recent call last):
  File "C:/Users/dnTTT/PycharmProjects/crypt/testapiconnect.py", line 13, in <module>
    print requests.get('http://127.0.0.1:5000/getdata', auth=HTTPBasicAuth('user', 'password')).json()
  File "C:\Python27\lib\site-packages\requests\models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

But know I'm getting this one

I would like help in just one thing

@app.route('/getdata', methods =['GET', 'POST'])
#@requires_auth
def get_data():

    config = {
        'user': 'user',
        'password': 'password.',
        'host': '127.0.0.1',
        'database': 'database',
        'raise_on_warnings': True,
        'use_pure': False,
    }

    cnx = mysql.connector.connect(**config)

    cur = cnx.cursor()

    cur.execute("SELECT hash FROM hash_files")


    rows = cur.fetchall()
    response = [row['hash'] for row in rows]

    return jsonify(response)
   

    cnx.close()

I get this error "tuple indices must be integers, not str" can someone help me please?

I would like help in just one thing

@app.route('/getdata', methods =['GET', 'POST'])
#@requires_auth
def get_data():

    config = {
        'user': 'user',
        'password': 'password.',
        'host': '127.0.0.1',
        'database': 'database',
        'raise_on_warnings': True,
        'use_pure': False,
    }

    cnx = mysql.connector.connect(**config)

    cur = cnx.cursor()

    cur.execute("SELECT hash FROM hash_files")


    rows = cur.fetchall()
    response = [row['hash'] for row in rows]

    return jsonify(response)
   

    cnx.close()

I get this error "tuple indices must be integers, not str" can someone help me please?

I got that error before, but now I have this one

    Traceback (most recent call last):
  File "C:/Users/dnTTT/PycharmProjects/crypt/testapiconnect.py", line 13, in <module>
    print requests.get('http://127.0.0.1:5000/getdata', auth=HTTPBasicAuth('user', 'password')).json()
  File "C:\Python27\lib\site-packages\requests\models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

But know I'm getting this one

Source Link
ShwSvn
  • 79
  • 3
  • 8
Loading