def GET(self):
   auth.get()
   try:
     log, userlist = system.call_helper(["userdb"])
     return view.render.users(userlist.strip().split("\n"))
   except Exception as e:
     return view.render.report("Error", e.message)
Beispiel #2
0
def users():
	if not session.get('admin'):
		return redirect(url_for('index'))
	if request.method == 'GET':
		return render_template('users.html', users=auth.get())
	else:
		if 'delete' in request.form:
			user = request.form.get('delete')
			auth.remove(user)
			flash('User "%s" deleted.' % user, 'success')
		elif 'add' in request.form:
			return redirect(url_for('user_new'))
		elif 'edit' in request.form:
			return redirect(url_for('user_edit', user=request.form.get('edit')))
		elif 'set' in request.form:
			name = request.form.get('set')
			password = request.form.get('pass')
			if not password:
				password = False
			admin = True if request.form.get('admin') == 'on' else False
			action = request.form.get('action')
			#FIXME: log
			auth.set(name=name, password=password, admin=admin)
			if action == 'add':
				flash('User "%s" created.' % (name), 'success')
			else:
				flash('User "%s" updated.' % (name), 'success')
		return redirect(url_for('users'))
Beispiel #3
0
def set_initial_stuff():
    """
    Just to setup the initial common variables
    """
    global headers, base_url,req_type
    try:
        headers = {}
        headers.update(net.DEFAULT_HEADERS)
        headers.update({'AUTHENTICATION':auth.get('lymbix_api_key'),'Accept':'application/json','VERSION':'2.2'})
        base_url = 'http://api.lymbix.com/'
        req_type = ['tonalize','tonalize_detailed','tonalize_multiple','flag_response']
    except Exception,e:

        raise e
Beispiel #4
0
import collections
import nltk
from nltk.corpus import stopwords
import networkx
import warnings
import auth
import twitter_utilities as tu

warnings.filterwarnings("ignore")

#use Seaborn to style results
sns.set(font_scale=1.5)
sns.set_style("whitegrid")

#authenticate and return api object
tw_auth = auth.get()
api = tw.API(tw_auth, wait_on_rate_limit=True)

#define search term criteria
search_words = u"#coronavirus"

#append filter to eliminate retweets
filtered_search = search_words + " -filter:retweets"

#define date criteria
date_since = u"2020-01-01"

#collect tweets
#limit to English only
#limit results to 50
tweets = tw.Cursor(api.search,
Beispiel #5
0
def get_authentication():
    return auth.get()
 def GET(self):
   user, admin = auth.get()
   return view.render.index(user, admin)
 def GET(self):
   auth.get()
   return view.render.new_user()
Beispiel #8
0
def user_edit(user):
	if not session.get('admin'):
		flash("You don't have permission to do that.", 'error')
		return redirect(url_for('index'))
	return render_template('user_form.html', user=auth.get(user), name=user)