{u'status':{u'http_code':200},u'contents':{u'error':{u'error_type':u'Application Key Error',u'error_message':u'Please provide your Application Key in the URL as "?app_key=<APP_KEY>".'}}}
After a few hours of trying to get past the Eventbrite API’s “Application Key Error”. I finally figured out that I needed to switch my request URL from:
None is hashable, so it works as a dictionary key like any other immutable value.
>>>my_dict={None:"value"}>>>my_dict[None]'value'
This is handy when you’re grouping rows by a column that can be NULL, because the NULL group gets None for its key and you don’t have to invent a sentinel value to stand in for it.
“If you can process the results of database queries iteratively (and very often you can), stream the results”
“Since the data needs to travel over the network from the database whether it’s streamed or not, this doesn’t add a huge overhead, but we’ll see that it reduces memory requirements.”
If you’re doing this with MySQL, the driver also has to use a server-side cursor or it buffers the whole result set regardless. mysqlclient, the maintained fork of MySQL-python, and PyMySQL both provide SSCursor for that. I originally recommended oursql here, but its last release was in 2016 and it does not install on Python 3.
If you’re going to be expecting more than one user on your flask server, you need to enable threading like this: app.run(host='0.0.0.0', port=5000, threaded=True)
Unfortunately, the threading makes Ctrl+C not work sometimes and I’ll have to kill the thread manually.
Warning: As of 10/17/2014, it’s still in development and they haven’t implemented scrollback yet. However, you can use screen and view the scrollback with Ctrl+A then Esc.