Gramex features a built-in log viewer application. This is a mini-application that is embedded with Gramex.
This currently shows the
Users can select any period over which to view this data, and filter for specific users, statuses, etc.
Deploying the application just required adding this configuration:
import:
logviewer:
path: $GRAMEXAPPS/logviewer/gramex.yaml # Source of the app
YAMLURL: $YAMLURL/log/ # Location to mount at
namespace: [url, schedule] # Avoid name space conflicts
auth: ... # Restrict access as required
ProxyHandler, which was introduced in v1.29 that lets you access REST APIs from the browser. We can connect to most web applications:
This has 2 advantages:
For example, a simple configuration exposes the Google Translation API to Gramex apps:
Translate “How are you” to Hindi
ProxyHandler is more powerful with the OAuth2 handler - which is new in v1.30. This lets users log into all the above applications, and allows ProxyHandler to access the logged in user’s data.
This also lets us build secure applications where Gramex does not store data, but shows users their own data, like:
Users can now into multiple auth engines at the same time. For example, you can log in with both DBAuth and LDAP. This lets you link users’ DBAuth login to an LDAP login ID dynamically.
This is enabled by user attributes. All auth handlers let you define which session key to store the user attributes in.
This defaults to user
. But you can set it to ldap
for the LDAP auth handler,
and have handler.session.user
hold the DBAuth info, and handler.session.ldap
hold the LDAP info.
If you want to save this information somewhere, or perform any post-login action, the best place to do that is login actions.
Gramex is now integrated with Amazon’s SNS. This lets us send an SMS message at fairly low rates.
You can test it out here.
The code to do this is simple too. Once configured, just run:
notifier.send(
to='+919741552552',
subject='This is from Gramex',
)
Here is the output:
This lets you send mobile alerts if there’s any unusual business scenario, like:
You can also send mobile alerts as summaries. For example:
This also paves the way for more features, like:
Earlier, if gramex.yaml
changed, Gramex would reload the entire application.
Re-launching ChromeCapture, PhantomJS, and every single one of your handlers,
schedulers, etc.
Now Gramex is faster. It reloads a handler or scheduler only if its configuration has changed.
Gramex can also be dynamically reconfigured. – creating new URLs on the fly. This can be used to:
NOTE: Since these URLs are constructed dynamically, it makes the application more complex that it is worth. Use with caution.
The Guide now features a Search feature with full-text search. This is handy if you want to understand:
The deployment guide has a new section on shared deployment that lists common problems when deploying multiple applications to the same instance - like on uat.gramener.com. The biggest problem is that the app runs locally, but not on the server. And it’s simple to fix.
gramex.cache.open(path, 'bin')
returns the path contents in binary modegramex.yaml
files are treated as empty files, and no longer stop the re-configuration.change
was not initiated. FixedTo upgrade Gramex, run:
pip uninstall gramex
pip install --verbose https://github.com/gramener/gramex/archive/master.zip
This downloads Chromium and other front-end dependencies. That may take time.