Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bottle import route, run, Bottle
- #This doesn't work because this isn't the correct way to use regular expressions.
- import re
- #These four inputs from tutorial: https://github.com/blueyed/lib-pyFreenet-staging/blob/master/tutorial.py
- import sys, os
- app = Bottle()
- def nocomma_filter(config):
- ''' Matches a comma separated list of numbers. '''
- regexp = r'[^,/@]+'
- print config
- def to_python(match):
- print match
- return match
- def to_url(astr):
- print astr
- return astr
- return regexp, to_python, to_url
- app.router.add_filter('nocomma', nocomma_filter)
- @app.route('/USK@<hashKey:nocomma>,<ecryptionKey:nocomma>,<encryption:nocomma>/<metaData:path>')
- def hello(hashKey,ecryptionKey,encryption,metaData):
- mimetype, val1 = node.get(uri)
- return ('hashKey=' + hashKey + '<br>' +
- 'ecryptionKey=' + ecryptionKey + '<br>' +
- 'encryption=' + encryption + '<br>' +
- 'metaData=' + metaData)
- #Regular eressions use a seperate filter; https://bottlepy.org/docs/dev/routing.html
- app.run(host='localhost', port=8081, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement