def sample(id): #headers! to authenticate user during API calls (for private data and to add/edit their samples) headers = None if session.get("auth_token", None): headers = {"Authorization": "Token "+session.get("auth_token")} #get the sample the usual way and return error message if something went wrong sample = get(env("API_HOST")+"samples/"+id+"/", params = {"format": "json"}, headers = headers).json() if "detail" in sample: flash(sample["detail"]) return redirect(url_for("search")) #make lat/long and date nice pos = sample["location_coords"].split(" ") sample["location_coords"] = [round(float(pos[2].replace(")","")),5), round(float(pos[1].replace("(","")),5)] if sample["collection_date"]: sample["collection_date"] = sample["collection_date"][:-10] #get subsample and analysis data for tables subsamples = [] for s in sample["subsample_ids"]: subsamples.append(get(env("API_HOST")+"subsamples/"+s, params = {"fields": "subsample_type,name,id,public_data,owner", "format": "json"}, headers = headers).json()) for s in subsamples: s["chemical_analyses"] = get(env("API_HOST")+"chemical_analyses/", params = {"subsample_ids": s["id"], "fields": "id", "format": "json"}, headers = headers).json()["results"] return render_template("sample.html", sample = sample, subsamples = subsamples, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def delete_account(self, username): # Remove user from members group group_dn = env("LDAP_MEMBER_GROUP_DN") self.ldap.modify_s(group_dn, [(ldap.MOD_DELETE, 'memberUid', username.encode('utf-8'))]) # Remove user dn = env("LDAP_USER_DN_TEMPLATE") % {'user': username} self.ldap.delete_s(dn)
def chemical_analyses(): #similar to samples filters = dict(request.args) for key in filters.keys(): f = "" for i in range(len(filters[key])): if filters[key][i]: f += str(filters[key][i])+',' if f: filters[key] = f[:-1] else: del filters[key] filters["format"] = "json" if "minerals_and" in filters: del filters["minerals_and"] headers = None if session.get("auth_token", None): headers = {"Authorization": "Token "+session.get("auth_token")} else: filters["public_data"] = True chemicals = get(env("API_HOST")+"chemical_analyses/", params = filters).json() chem_results = chemicals["results"] next_url, prev_url, last_page, total = paginate_model("chemical_analyses", chemicals, filters) #collect sample ids and corresponding names samples = set() for c in chem_results: samples.add(c["subsample"]["sample"]) samples = get(env("API_HOST")+"samples/", params = {"fields": "number,id", "ids": (",").join(list(samples)), "format": "json"}, headers = headers).json()["results"] numbers = {} for s in samples: numbers[s["id"]] = s for c in chem_results: c["sample"] = numbers[c["subsample"]["sample"]] if c["analysis_date"]: c["analysis_date"] = c["analysis_date"][:-10] return render_template("chemical_analyses.html", chemical_analyses = chem_results, total = total, next_url = next_url, prev_url = prev_url, first_page = url_for("chemical_analyses")+"?"+urlencode(filters), last_page = last_page, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def apply_settings(settings): username = env('USER') # this is the unix username stage = username.split('-')[1] server_cfg = {'username': username, 'site': os.environ.get('DEPLOYMENT_SITE', 'main')} settings.DATA_ROOT = '/home/%(username)s/upload/' % server_cfg settings.MEDIA_ROOT = '/home/%(username)s/upload/media/' % server_cfg settings.STATIC_ROOT = '/home/%(username)s/static/' % server_cfg settings.LOG_ROOT = '/home/%(username)s/log/' % server_cfg settings.SOCKET_ROOT = '/home/%(username)s/tmp/' % server_cfg settings.REDIS_SOCKET = '/home/%(username)s/tmp/%(username)s_%(site)s_redis.sock' % server_cfg settings.ALLOWED_HOSTS = env("ALLOWED_HOSTS", ['%(username)s.divio.ch' % server_cfg]) import dj_database_url settings.DATABASES = {'default': dj_database_url.config(default='postgres://%(username)s@/%(username)s' % server_cfg)}
def test_mymedicare_valid_login_succeeds(self): """ Test MyMedicare valid login succeeds. When user is authenticated by MyMedicare, then user is presumed a benny """ form_data = {'username': env('MM_USER', 'CHANGE_ME'), 'password': env('MM_PASS', 'CHANGE_ME')} response = self.client.post(self.url, form_data, follow=True) up = UserProfile.objects.get(user__username=env('MM_USER', 'CHANGE_ME')) # This user is a beneficiary. self.assertEqual(up.user_type, 'BEN') # The user is logged in self.assertContains(response, "Logout")
def change_email(self, username, email): # Changes the email address for the given user dn = env("LDAP_USER_DN_TEMPLATE") % {'user': username} mod_attrs = [ (ldap.MOD_REPLACE, 'mail', email.encode('utf-8')), ] self.ldap.modify_s(dn, mod_attrs)
def test(): #Capture bulk upload details inputted by user (url, filetype) formatted as #JSON that was sent from JavaScript #auth_token = session.get("auth_token",None), UserInput = request.json response = None print "Type received from user input: ", type(UserInput) if (UserInput != None): headers = None if session.get("auth_token", None): print "User auth_token:",session.get("auth_token") print "UserInput:",UserInput headers = {"Authorization": "Token "+session.get("auth_token")} else: return render_template('index.html') response = post(env("API_HOST")+"bulk_upload/", json = UserInput, headers = headers) print "Response status code:",response.status_code print "Response content (json):",response.json() ''' return render_template('bulk_upload_results.html', bulk_upload_output = response.json(), auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) ) ''' return jsonify(results=response.json())
def sentry(request): sentry_id = '' if hasattr(request, 'sentry'): sentry_id = request.sentry['id'] return { 'sentry_id': sentry_id, 'sentry_public_id': env('SENTRY_PUBLIC_DSN', ''), }
def add_account(self, member, username, password): # Adds new account for the given member with the given username and password dn = env("LDAP_USER_DN_TEMPLATE") % {'user': username} uidnumber = self.get_next_uidnumber() nt_pw = self.get_samba_password(password) # Everything has to be byte string because why the f**k not? attrs = {} attrs['uid'] = [username.encode('utf-8')] attrs['cn'] = [member.full_preferred_name.encode('utf-8')] homedir = '/rhome/%s' % username attrs['homeDirectory'] = [homedir.encode('utf-8')] attrs['uidNumber'] = [str(uidnumber).encode('utf-8')] attrs['mailHost'] = [b'smtp.ayy.fi'] attrs['gidNumber'] = [b'1000'] attrs['sn'] = [member.surname.encode('utf-8')] attrs['givenName'] = [member.preferred_name.encode('utf-8')] attrs['loginShell'] = [b'/bin/bash'] attrs['objectClass'] = [ b'kerberosSecurityObject', b'inetOrgPerson', b'posixAccount', b'shadowAccount', b'inetLocalMailRecipient', b'top', b'person', b'organizationalPerson', b'billAccount', b'sambaSamAccount' ] attrs['krbName'] = [username.encode('utf-8')] attrs['mail'] = [member.email.encode('utf-8')] attrs['userPassword'] = [self.hash_user_password(password)] sambasid = "S-1-0-0-%s" % str(uidnumber*2+1000) attrs['sambaSID'] = [sambasid.encode('utf-8')] attrs['sambaNTPassword'] = [nt_pw.encode('utf-8')] attrs['sambaPwdLastSet'] = [str(int(time.time())).encode('utf-8')] # Add the user to LDAP ldif = modlist.addModlist(attrs) self.ldap.add_s(dn, ldif) # Add user to Members group group_dn = env("LDAP_MEMBER_GROUP_DN") self.ldap.modify_s(group_dn, [(ldap.MOD_ADD, 'memberUid', username.encode('utf-8'))])
def change_password(self, username, password): # Changes both the user password and the samba password dn = env("LDAP_USER_DN_TEMPLATE") % {'user': username} nt_pw = self.get_samba_password(password) mod_attrs = [ (ldap.MOD_REPLACE, 'userPassword', self.hash_user_password(password)), (ldap.MOD_REPLACE, 'sambaNTPassword', nt_pw.encode('utf-8')) ] self.ldap.modify_s(dn, mod_attrs)
def handle(self, *args, **options): # get variables super_username = env("DJANGO_SUPERUSER_USERNAME", "") super_password = env("DJANGO_SUPERUSER_PASSWORD", "") super_email = env("DJANGO_SUPERUSER_EMAIL", "") if super_username and super_password and super_email: # create a super user r = create_superuser(super_username, super_password, super_email) if r: print("Superuser created/updated.") else: print("Something went wrong") else: print( "Environment variables DJANGO_SUPERUSER_USERNAME, DJANGO_SUPERUSER_PASSWORD,", "DJANGO_SUPERUSER_EMAIL must be set before using this command.", )
def searchChemicals(self, filters={}, nextpage=''): if nextpage: self.api = drest.api.TastyPieAPI('{0}{1}'.format(env('HOST_NAME'), nextpage)) if filters: response = self.api.chemical_analysis.get(params=filters) return response else: response = self.api.chemical_analysis.get() return response
def chemical_analysis(id): email = session.get('email', None) api_key = session.get('api_key', None) payload = {'email': email, 'api_key': api_key} url = env('API_HOST') + '/chemical_analysis/{0}'.format(id) response = get(url, params=payload) return render_template('chemical_analysis.html', data=response.json())
def _add_purchase(self, user): promo_code = PromoCode.objects.get(code=env('CDPT_MENTORS_PROMO_CODE')) product = Product.objects.order_by('id')[0] Purchase.objects.create( user=user, promo_code=promo_code, product=product, payment_status=PaymentStatusName.SUCCESS.value, payment_type=PaymentTypeName.FREE.value )
def login(): #redirect to index if already logged in if session.get("auth_token", None): return redirect(url_for("index")) login = dict(request.form) if login: #get email/password/(other info if registering) for l in login.keys(): if login[l]: login[l] = login[l][0] else: del login[l] register = (login["login"] == "Register") del login["login"] #try to login/register auth_token = {} if register: auth_token = post(env("API_HOST")+"auth/register/", data = login).json() else: auth_token = post(env("API_HOST")+"auth/login/", data = login).json() #http://45.55.207.138/api/users/9fc3b7ab-cec5-450a-9b33-b3200a5eaca5/ if not auth_token or "auth_token" not in auth_token: flash((',').join(auth_token.values()[0])) else: flash("Login successful!") session["auth_token"] = auth_token["auth_token"] session["email"] = login["email"] session["id"] = auth_token["user_id"] session["name"] = get(env("API_HOST")+"users/"+session["id"], params = {"fields": "name"}, headers = {"Authorization": "Token "+session["auth_token"]}).json()["name"] return redirect(url_for("index")) return render_template("login.html", auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def request_contributor_access(request): try: user = User.objects.get(email=request.GET['email']) except: return HttpResponseNotFound("Invalid email address") if user.enabled == "N": return HttpResponseForbidden("Please confirm your email address first.") if user.contributor_code != '': return HttpResponseForbidden("You have already requested access.") if user.contributor_enabled == 'Y': return HttpResponseForbidden("This user is already a contributor") allowed_params = ['professional_url', 'research_interests', 'institution', 'reference_email'] for param, value in request.GET.iteritems(): if param in allowed_params: setattr(user, param, value) user.contributor_code = generate_confirmation_code(user.email) user.save() plaintext = get_template('request_contributor_access.txt') html = get_template('request_contributor_access.html') d = Context({ 'name': env('SUPERUSER_NAME'), 'user': user, 'host_name': settings.HOST_NAME }) subject = 'hello' from_email = env('DEFAULT_FROM_EMAIL') to = env('SUPERUSER_EMAIL') text_content = plaintext.render(d) html_content = html.render(d) msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") msg.send() return HttpResponse("Your request to be added as a contributor has been submitted")
def search_chemistry(): #basically the same as search samples but with analysis filter options if request.args.get("resource") == "chemical_analyses": return redirect(url_for("chemical_analyses")+"?"+urlencode(request.args)) if request.args.get("resource") == "sample": return redirect(url_for("samples")+"?"+urlencode(request.args)+"&chemical_analyses_filters=True") oxides = get(env("API_HOST")+"oxides/", params = {"fields": "species", "page_size": 100, "format": "json"}).json()["results"] elements = get(env("API_HOST")+"elements/", params = {"fields": "name,symbol", "page_size": 120, "format": "json"}).json()["results"] minerals = get(env("API_HOST")+"minerals/", params = {"fields": "name", "page_size": 200, "format": "json"}).json()["results"] return render_template("chemical_search_form.html", oxides = oxides, elements = elements, minerals = minerals, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def search(): #get all filter options from API, use format = json and minimum page sizes to speed it up if request.args.get("resource") == "samples": #resource value set in search_form.html, appends samples.html to bottom of page fixedListArgs = combine_identical_parameters(request.args.iteritems(multi=True)) return redirect(url_for("samples")+"?"+urlencode(fixedListArgs)) if request.args.get("resource") == "chemical_analyses": #minerals_and option not valid parameter for analyses #sets sample_filters b/c search samples only has sample filters #appends chemical_analyses.html to bottom of page return redirect(url_for("chemical_analyses")+"?"+urlencode(request.args)+"&sample_filters=True") #get all filter options from API, use format = json and minimum page sizes to speed it up regions = get(env("API_HOST")+"regions/", params = {"fields": "name", "page_size": 2000, "format": "json"}).json()["results"] minerals = get(env("API_HOST")+"minerals/", params = {"fields": "name", "page_size": 200, "format": "json"}).json()["results"] rock_types = get(env("API_HOST")+"rock_types/", params = {"fields": "name", "page_size": 40, "format": "json"}).json()["results"] collectors = get(env("API_HOST")+"collectors/", params = {"fields": "name", "page_size": 140, "format": "json"}).json()["results"] references = get(env("API_HOST")+"references/", params = {"fields": "name", "page_size": 1100, "format": "json"}).json()["results"] metamorphic_grades = get(env("API_HOST")+"metamorphic_grades/", params = {"fields": "name", "page_size": 30, "format": "json"}).json()["results"] metamorphic_regions = get(env("API_HOST")+"metamorphic_regions/", params = {"fields": "name", "page_size": 240, "format": "json"}).json()["results"] countries = get(env("API_HOST")+"country_names/", params = {"format": "json"}).json()["country_names"] numbers = get(env("API_HOST")+"sample_numbers/", params = {"format": "json"}).json()["sample_numbers"] owners = get(env("API_HOST")+"sample_owner_names/", params = {"format": "json"}).json()["sample_owner_names"] return render_template("search_form.html", regions = regions, minerals = minerals, rock_types = rock_types, collectors = collectors, references = references, metamorphic_grades = metamorphic_grades, metamorphic_regions = metamorphic_regions, countries = countries, numbers = numbers, owners = owners, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def chemical_analysis(id): #similar to sample and subsample headers = None if session.get("auth_token", None): headers = {"Authorization": "Token "+session.get("auth_token")} analysis = get(env("API_HOST")+"chemical_analyses/"+id+"/", params = {"format": "json"}, headers = headers).json() if "detail" in analysis: flash(analysis['detail']) return redirect(url_for("search_chemistry")) #have to get sample number still analysis["sample"] = get(env("API_HOST")+"samples/"+analysis["subsample"]["sample"], params = {"fields": "number", "format": "json"}, headers = headers).json() return render_template("chemical_analysis.html", analysis = analysis, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def request_password_reset(): #get data from form form = dict(request.form) if form: #get email data email_data = post(env("API_HOST")+"auth/password/reset/", data = form).json() if not email_data or "detail" in email_data: flash("Invalid email. Please try again.") else: #send email message = Message("Metpetdb: Reset Password", sender = env("DEFAULT_MAIL_SENDER"), recipients = [form["email"]]) reset_url = url_for("reset_password", token = email_data["link"], _external = True) message.body = render_template("reset_password_email.html", reset_url = reset_url) mail.send(message) flash("Please check your email for a link to reset your password") return redirect(url_for("login")) return render_template("request_password_reset.html", auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def request_reset_password(): form = RequestPasswordResetForm() if form.validate_on_submit(): payload = {'email': form.email.data} response = post(env('API_HOST') + '/reset-password/', data=payload) if response.status_code == 200: data = json.loads(response.text) message = Message("Metpetdb: Reset Password", sender=env('DEFAULT_MAIL_SENDER'), recipients=[form.email.data]) reset_url = url_for('reset_password', token=data['reset_token'], _external=True) message.body = render_template('reset_password_email.html', reset_url=reset_url) mail.send(message) flash('Please check your email for a link to reset your password') return redirect(url_for('login')) else: flash("Invalid email. Please try again.") return render_template('request_password_reset.html', form=form)
def get_next_uidnumber(self): # Returns the next free uidnumber greater than 1000 output = self.ldap.search_s(env("LDAP_USER_DN"), ldap.SCOPE_ONELEVEL, attrlist=['uidNumber']) uidnumbers = [int(user[1]['uidNumber'][0]) for user in output] uidnumbers.sort() # Find first free uid over 1000. last = 1000 for uid in uidnumbers: if uid > last + 1: break last = uid return last + 1
def apply_settings(settings): s = settings s.DATA_ROOT = os.path.abspath(env("DATA_ROOT", os.path.join(s.PROJECT_ROOT, 'tmp'))) s.MEDIA_ROOT = env("MEDIA_ROOT", os.path.join(s.DATA_ROOT, 'media')) s.STATIC_ROOT = env("STATIC_ROOT", os.path.join(s.DATA_ROOT, 'static_collected')) s.LOG_ROOT = env("LOG_ROOT", os.path.join(s.DATA_ROOT, 'logs')) s.SOCKET_ROOT = env("SOCKET_ROOT", s.DATA_ROOT) s.REDIS_SOCKET = env("REDIS_SOCKET", os.path.join(s.SOCKET_ROOT, 'redis.sock')) s.ALLOWED_HOSTS = env("ALLOWED_HOSTS", ['127.0.0.1', 'localhost',]) import dj_database_url s.DATABASES = {'default': dj_database_url.config(default='sqlite:///%s' % os.path.join(s.DATA_ROOT, 'db.sqlite3'))}
def subsample(id): headers = None if session.get("auth_token", None): headers = {"Authorization": "Token "+session.get("auth_token")} #get subsample info subsample = get(env("API_HOST")+"subsamples/"+id+"/", params = {"format": "json"}, headers = headers).json() if "detail" in subsample: flash(subsample['detail']) return redirect(url_for("search")) #get sample and analysis info subsample["sample"]["number"] = get(env("API_HOST")+"samples/"+subsample["sample"]["id"], params = {"fields": "number", "format": "json"}, headers = headers).json()["number"] chemical_analyses = get(env("API_HOST")+"chemical_analyses/", params = {"subsample_ids": subsample["id"], "format": "json"}).json()["results"] return render_template("subsample.html", subsample = subsample, chemical_analyses = chemical_analyses, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def test(): #Capture bulk upload details inputted by user (url, filetype) formatted as #JSON that was sent from JavaScript #auth_token = session.get("auth_token",None), UserInput = request.json response = None print "Type received from user input: ", type(UserInput) if (UserInput != None): UserInput = dict([(str(k), str(v)) for k, v in UserInput.items()]) headers = None # if session.get("auth_token", None): print "User auth_token:",session.get("auth_token") print "User id:",session.get("user_id") print "UserInput:",UserInput headers = {"Authorization": "Token "+session.get("auth_token")} UserInput["owner"]=session.get("id") # print response.json() # print "Owner:",UserInput["owner"] # else: # pass # return render_template('index.html') response = post(env("API_HOST")+"bulk_upload/", json = UserInput, headers = headers) # response_dict = dict(response.json()[0]) # new_response = dict() # for key in response_dict: # # new_key = key.replace('_', " ") # new_key = key # new_response[new_key] = response_dict[key] # print key, new_key, len(new_response) # # print "new response:", new_response # json_response = jsonify(new_response) print response # print "Keys:", new_response.keys() print "Response status code:",response.status_code print "Response:",response print "Response content (json):",response.json() ''' return render_template('bulk_upload_results.html', bulk_upload_output = response.json(), auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) ) ''' return jsonify(results=response.json())
def reset_password(token): form = PasswordResetForm() if form.validate_on_submit(): payload = {'token': form.token.data, 'password': form.password.data} response = post(env('API_HOST') + '/reset-password/', data=payload) if response.status_code == 200: data = json.loads(response.text) session['email'] = data['email'] session['api_key'] = data['api_key'] flash('Password reset successful!') return redirect(url_for('search')) else: flash('Password reset failed. Please try again.') return redirect(url_for('request_reset_password')) if token: response = get(env('API_HOST') + '/reset-password/' + token) if response.status_code == 200: form = PasswordResetForm(token=token) return render_template('reset_password.html', form=form) flash('Password reset failed. Please try again.') return redirect(url_for('request_reset_password'))
def apply_all_settings(settings): # TODO: make this configurable from .settings import default as defaults_mod defaults_mod.apply_pre_environment_settings(settings) # TODO: environment should be dynamically imported with AUTOSETUP autoconfig = env('AUTOSETUP', 'standardsettings.environments.local') if autoconfig == 'standardsettings.environments.local': from .environments import local as env_mod elif autoconfig == 'standardsettings.environments.divio_nine_cloud': from .environments import divio_nine_cloud as env_mod else: raise Exception("must define autoconfig") env_mod.apply_settings(settings) defaults_mod.apply_post_environment_settings(settings)
def user(): headers = None if session.get("auth_token", None): headers = {"Authorization": "Token "+session.get("auth_token")} else: return redirect(url_for("index")) user = get(env("API_HOST")+"users/"+session.get("id"), params = {"format": "json"}, headers = headers).json() if "detail" in user: flash(user['detail']) return redirect(url_for("index")) return render_template("user.html", user = user, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def reset_password(token): #get password data password = request.form.get("password",None) if password: #send new password to API reset_data = post(env("API_HOST")+"auth/password/reset/confirm/", data = {"token": token, "password": password}).json() if not reset_data or "detail" in reset_data: flash("Password reset failed. Please try again.") return redirect(url_for("request_password_reset")) else: session["auth_token"] = reset_data["auth_token"] flash("Password reset successful! You are now logged in.") return redirect(url_for("index")) return render_template("reset_password.html", auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def edit_subsample(id): #similar to but much simpler than edit sample headers = None if session.get("auth_token", None): headers = {"Authorization": "Token "+session.get("auth_token")} else: return redirect(url_for("subsample", id = id)) new = (id == "new") if new: sample = get(env("API_HOST")+"samples/"+request.args.get("sample_id")+"/", params = {"fields": "id,number,owner"}, headers = headers).json() subsample = dict(request.form) if subsample: for key in subsample.keys(): if subsample[key] and subsample[key][0]: subsample[key] = subsample[key][0] #subsample["sample_id"] = sample_id #subsample["owner_id"] = sample["owner"]["id"] subsample = json.dumps(subsample) if new: response = post(env("API_HOST")+"subsamples/", json = subsample, headers = headers) print response.status_code else: response = put(env("API_HOST")+"subsamples/"+id+"/", json = subsample, headers = headers) if response.status_code < 300: return redirect(url_for("subsample", id = response.json()["id"])) try: errors = response.json() except: errors = [] else: errors = [] if new: subsample = {"owner": sample["owner"], "sample": sample} else: subsample = get(env("API_HOST")+"subsamples/"+id+"/", params = {"format": "json"}, headers = headers).json() subsample["owner"] = get(env("API_HOST")+"users/"+subsample["owner"]["id"], params = {"format": "json"}, headers = headers).json() types = get(env("API_HOST")+"subsample_types/", headers = headers).json()["results"] return render_template("edit_subsample.html", subsample = subsample, types = types, errors = errors, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def search_chemistry(): api = drest.API(baseurl=env('API_DRF_HOST')) filters = {} for key in dict(request.args): if dict(request.args)[key][0] and key != 'resource': filters[key] = (',').join(dict(request.args)[key]) if request.args.get('resource') == 'chemicalanalysis': return redirect( url_for('chemical-analyses') + '?' + urlencode(filters)) if request.args.get('resource') == 'sample': filters['chemical_analyses_filters'] = True return redirect(url_for('samples') + '?' + urlencode(filters)) oxides = api.make_request('GET', '/oxides/', params={ 'fields': 'species', 'page_size': 100, 'format': 'json' }).data['results'] elements = api.make_request('GET', '/elements/', params={ 'fields': 'name,symbol', 'page_size': 120, 'format': 'json' }).data['results'] minerals = api.make_request('GET', '/minerals/', params={ 'fields': 'name', 'page_size': 200, 'format': 'json' }).data['results'] return render_template('chemical_search_form.html', elements=elements, oxides=oxides, minerals=minerals)
def reset_password(): #get password data form = dict(request.form) print form password = request.form.get("new_password",None) if password: #send new password to API response = post(env("API_HOST")+"auth/password/reset/confirm/", data = form) if response.status_code != 200: flash("Password reset failed. Please try again.") return redirect(url_for("request_password_reset")) else: flash("Password reset successful!") return redirect(url_for("login")) return render_template("reset_password.html", auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def create_root_user(apps, schema_editor): if not env("DJANGO_SUPERUSER_USERNAME", False) or \ not env("DJANGO_SUPERUSER_USERNAME", False) or \ not env("DJANGO_SUPERUSER_EMAIL", False): print( "Misconfigured, initial DJANGO_SUPERUSER_USERNAME, PASSWORD and EMAIL should be in the env." ) else: User = get_user_model() try: User.objects.create_superuser(env("DJANGO_SUPERUSER_USERNAME"), env("DJANGO_SUPERUSER_EMAIL"), env("DJANGO_SUPERUSER_PASSOWRD")) except IntegrityError: print("The superuser with this username was already created.")
def project(id): # headers! to authenticate user during API calls (for private data and to add/edit their samples) headers = None if session.get("auth_token", None): headers = {"Authorization": "Token "+session.get("auth_token")} project = dict() project["id"] = "00011" project["name"] = "Rocks from the world" project["public_data"] = True project["creation_date"] = "2019-01-01" project["description"] = "This is a test project" project["owner"] = get(env("API_HOST") + "users/" + session.get("id") + "/", headers=headers).json() return render_template("project.html", project=project, auth_token = session.get("auth_token",None), email = session.get("email",None), name=session.get("name", None), edit_permission = session.get("id", None) == project["owner"]["id"] )
def subscribe(): email = None if request.method == 'POST': email = request.form['email'] # Check that email does not already exist (not a great query, but works) if not db.session.query(User).filter(User.email == email).count(): reg = User(email) db.session.add(reg) db.session.commit() print reg.email mcl = call_other_functions() print mcl mandrill.send_email( from_email=env('FROM_MAIL'), to=[{'email': '*****@*****.**'}], # text="hello world" html=render_template("mail.html", mcl=mcl) ) return render_template('success.html') return render_template('index.html')
def search_chemistry(): #basically the same as search samples but with analysis filter options if request.args.get("resource") == "chemical_analyses": fixedListArgs = combine_identical_parameters(request.args.iteritems(multi=True)) return redirect(url_for("chemical_analyses")+"?"+urlencode(fixedListArgs)) if request.args.get("resource") == "sample": fixedListArgs = combine_identical_parameters(request.args.iteritems(multi=True)) return redirect(url_for("samples")+"?"+urlencode(fixedListArgs)+"&chemical_analyses_filters=True") # for dynamic field and sorting options fields_dict = {'Analysis Method':'analysis_method','Analysis Material':'mineral','Subsample Type':'subsample_type', \ 'Stage X':'stage_x','Stage Y':'stage_y','Reference':'reference','Reference X':'reference_x','Reference Y':'reference_y', \ 'Analysis Location':'where_done','Elements':'elements','Oxides':'oxides','Owner':'owner', \ 'Analyst':'analyst','Analysis Date':'analysis_date','Total':'total'} sorting_dict = {'Point':'spot_id','Analysis Method':'analysis_method','Analysis Material':'mineral','Subsample Type':'subsample_type', \ 'Analysis Location':'where_done','Reference':'reference','Owner':'owner','Analyst':'analyst','Analysis Date':'analysis_date','Total':'total'} #Add headers for authentication of oxides = {} elements = {} minerals = {} try: headers = {"Authorization":"Token "+session["auth_token"]} print "private search chemistry" print "header:",headers oxides = get(env("API_HOST")+"oxides/", params = {"fields": "species", "page_size": 100, "format": "json"},headers = headers).json()["results"] elements = get(env("API_HOST")+"elements/", params = {"fields": "name,symbol", "page_size": 120, "format": "json"},headers=headers).json()["results"] minerals = get(env("API_HOST")+"minerals/", params = {"fields": "name", "page_size": 200, "format": "json"},headers = headers).json()["results"] except: print "public search chemistry" headers = {} oxides = get(env("API_HOST")+"oxides/", params = {"fields": "species", "page_size": 100, "format": "json"}).json()["results"] elements = get(env("API_HOST")+"elements/", params = {"fields": "name,symbol", "page_size": 120, "format": "json"}).json()["results"] minerals = get(env("API_HOST")+"minerals/", params = {"fields": "name", "page_size": 200, "format": "json"}).json()["results"] return render_template("chemical_search_form.html", oxides = oxides, elements = elements, minerals = minerals, fields_dict = sorted(fields_dict), fields = sorted(fields_dict.keys()), sorting_dict = sorted(sorting_dict), auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
def test(): '''Capture bulk upload details inputted by user (url, filetype) formatted as JSON that was sent from JavaScript ''' # auth_token = session.get("auth_token",None), UserInput = request.json response = None print "Type received from user input: ", type(UserInput) if (UserInput != None): UserInput = dict([(str(k), str(v)) for k, v in UserInput.items()]) headers = None # if session.get("auth_token", None): print "User auth_token:",session.get("auth_token") print "User id:",session.get("user_id") print "UserInput:",UserInput headers = {"Authorization": "Token "+session.get("auth_token")} UserInput["owner"]=session.get("id") response = post(env("API_HOST")+"bulk_upload/", json = UserInput, headers = headers) # response_dict = dict(response.json()[0]) # new_response = dict() # for key in response_dict: # # new_key = key.replace('_', " ") # new_key = key # new_response[new_key] = response_dict[key] # print key, new_key, len(new_response) # # print "new response:", new_response # json_response = jsonify(new_response) print response print "Response status code:",response.status_code print "Response:",response ''' return render_template('bulk_upload_results.html', bulk_upload_output = response.json(), auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) ) ''' return jsonify(results=response.json())
def apply_settings(settings): s = settings s.DATA_ROOT = os.path.abspath( env("DATA_ROOT", os.path.join(s.PROJECT_ROOT, 'tmp'))) s.MEDIA_ROOT = env("MEDIA_ROOT", os.path.join(s.DATA_ROOT, 'media')) s.STATIC_ROOT = env("STATIC_ROOT", os.path.join(s.DATA_ROOT, 'static_collected')) s.LOG_ROOT = env("LOG_ROOT", os.path.join(s.DATA_ROOT, 'logs')) s.SOCKET_ROOT = env("SOCKET_ROOT", s.DATA_ROOT) s.REDIS_SOCKET = env("REDIS_SOCKET", os.path.join(s.SOCKET_ROOT, 'redis.sock')) s.ALLOWED_HOSTS = env("ALLOWED_HOSTS", [ '127.0.0.1', 'localhost', ]) import dj_database_url s.DATABASES = { 'default': dj_database_url.config(default='sqlite:///%s' % os.path.join(s.DATA_ROOT, 'db.sqlite3')) }
def login(): auth_token = session.get('auth_token', None) if auth_token: return redirect(url_for('search')) api = drest.TastyPieAPI(env('API_DRF_HOST'), auth_mech="basic") form = LoginForm() if form.validate_on_submit(): auth_token = api.make_request('POST', '/auth/login/', params={ 'email': form.email.data, 'password': form.password.data }) print auth_token if 'auth_token' in auth_token: session['email'] = form.email.data session['auth_token'] = auth_token['auth_token'] flash('Login successful!') return redirect(url_for('search')) else: flash('Authentication failed. Please try again.') return render_template('login.html', form=form)
def subsample(id): headers = None if session.get('auth_token', None): headers = { 'email': session.get('email'), 'auth_token': session.get('auth_token') } api = drest.API(baseurl=env('API_DRF_HOST')) subsample = api.make_request('GET', '/subsamples/' + id, params={ 'format': 'json' }, headers=headers).data print subsample if "detail" in subsample: return render_template("warning.html", text="Subsample " + id + " does not exist") subsample['sample']['number'] = api.make_request('GET', '/samples/' + subsample['sample']['id'], params={ 'fields': 'number', 'format': 'json' }).data['number'] chemical_analyses = api.make_request('GET', '/chemical_analyses/', params={ 'subsample_ids': subsample['id'], 'format': 'json' }).data['results'] return render_template('subsample.html', subsample=subsample, chemical_analyses=chemical_analyses)
def apply_pre_environment_settings(settings): s = settings s.DEBUG = env('DEBUG', False) s.TEMPLATE_DEBUG = env('TEMPLATE_DEBUG', s.DEBUG) s.SRC_ROOT = env('SRC_ROOT', os.path.dirname(s.__file__)) s.PROJECT_ROOT = env('PROJECT_ROOT', os.path.abspath(os.path.join(s.SRC_ROOT, '..'))) s.SECRET_KEY = env('SECRET_KEY') if not s.SECRET_KEY: raise ImproperlyConfigured( "you must set SECRET_KEY in your environment") s.SITE_ID = env('SITE_ID', 1) s.ROOT_URLCONF = 'urls' configure_media_and_static(settings) configure_templates(settings) configure_locale_and_time(settings) configure_debug_toolbar(settings)
def search_chemistry(): #basically the same as search samples but with analysis filter options if request.args.get("resource") == "chemical_analyses": fixedListArgs = combine_identical_parameters(request.args.iteritems(multi=True)) return redirect(url_for("chemical_analyses")+"?"+urlencode(fixedListArgs)) if request.args.get("resource") == "sample": fixedListArgs = combine_identical_parameters(request.args.iteritems(multi=True)) return redirect(url_for("samples")+"?"+urlencode(fixedListArgs)+"&chemical_analyses_filters=True") #Add headers for authentication of oxides = {} elements = {} minerals = {} try: headers = {"Authorization":"Token "+session["auth_token"]} print "private search chemistry" print "HEADER:",headers oxides = get(env("API_HOST")+"oxides/", params = {"fields": "species", "page_size": 100, "format": "json"},headers = headers).json()["results"] elements = get(env("API_HOST")+"elements/", params = {"fields": "name,symbol", "page_size": 120, "format": "json"},headers=headers).json()["results"] minerals = get(env("API_HOST")+"minerals/", params = {"fields": "name", "page_size": 200, "format": "json"},headers = headers).json()["results"] except: print "public search chemistry" headers = {} oxides = get(env("API_HOST")+"oxides/", params = {"fields": "species", "page_size": 100, "format": "json"}).json()["results"] elements = get(env("API_HOST")+"elements/", params = {"fields": "name,symbol", "page_size": 120, "format": "json"}).json()["results"] minerals = get(env("API_HOST")+"minerals/", params = {"fields": "name", "page_size": 200, "format": "json"}).json()["results"] print 'len',len(oxides),len(elements),len(minerals) return render_template("chemical_search_form.html", oxides = oxides, elements = elements, minerals = minerals, auth_token = session.get("auth_token",None), email = session.get("email",None), name = session.get("name",None) )
""" import os from django.contrib.messages import constants as messages from .utils import bool_env import dj_database_url from getenv import env BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DATABASE_DIR = os.path.join(BASE_DIR, 'db') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env('SECRET_KEY', '@+ttixefm9-bu1eknb4k^5dj(f1z0^97b$zan9akdr^4s8cc54') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = bool_env(env('DEBUG', True)) TEMPLATE_DEBUG = bool_env(env('DEBUG', True)) ALLOWED_HOSTS = [ '*', ] # Application definition INSTALLED_APPS = [ # Django apps 'django.contrib.admin',
import socket import datetime from getenv import env from ..utils import bool_env # # Add testac to Dev/Test environments only # if 'apps.fhir.testac' not in INSTALLED_APPS: # INSTALLED_APPS = INSTALLED_APPS + [ # 'apps.fhir.testac', # ] # Set ADMINS and MANAGERS ADMINS = (('Mark Scrimshire[Dev]', '*****@*****.**'), ) MANAGERS = ADMINS ALLOWED_HOSTS = env('DJANGO_ALLOWED_HOSTS', ['*', socket.gethostname()]) # if ALLOWED_HOSTS == ['*', socket.gethostname()]: # print("WARNING: Set DJANGO_ALLOWED_HOSTS to the hostname " # "for Production operation.\n" # " Currently defaulting to %s " % ALLOWED_HOSTS) # Warning: on macOS hostname is case sensitive # removing security enforcement in development mode # DEBUG = bool_env(env('DJANGO_DEBUG', True)) # DEBUG = True # Set to False while using as Developer Preview DEBUG = False if DEBUG: print("WARNING: Set DJANGO_DEBUG environment variable to False "
def get_val_from_env(key_name: str): return env(key_name)
'django_settings_export.settings_export', ], }, }, ] WSGI_APPLICATION = 'smh_app.wsgi.application' # Database # https://docs.djangoproject.com/en/2.1/ref/settings/#databases DATABASES = { 'default': dj_database_url.config( default=env('DATABASES_CUSTOM', 'sqlite:///{}/db.sqlite3'.format(BASE_DIR)) ), } MESSAGE_TAGS = { messages.DEBUG: 'debug', messages.INFO: 'info', messages.SUCCESS: 'success', messages.WARNING: 'warning', messages.ERROR: 'danger', } # Password validation # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
# ----------------------------------------------------------------------------------- # RapidPro settings file for the docker setup # ----------------------------------------------------------------------------------- from getenv import env import dj_database_url import django_cache_url from datetime import datetime from django.utils.translation import ugettext_lazy as _ from temba.settings_common import * # noqa INSTALLED_APPS = INSTALLED_APPS + tuple( filter(None, env("EXTRA_INSTALLED_APPS", "").split(","))) ROOT_URLCONF = env("ROOT_URLCONF", "temba.urls") DEBUG = env("DJANGO_DEBUG", "off") == "on" GEOS_LIBRARY_PATH = "/usr/local/lib/libgeos_c.so" GDAL_LIBRARY_PATH = "/usr/local/lib/libgdal.so" SECRET_KEY = env("SECRET_KEY", required=True) DATABASE_URL = env("DATABASE_URL", required=True) DATABASES = {"default": dj_database_url.parse(DATABASE_URL)} DATABASES["default"]["CONN_MAX_AGE"] = 60 DATABASES["default"]["ATOMIC_REQUESTS"] = True DATABASES["default"]["ENGINE"] = "django.contrib.gis.db.backends.postgis" REDIS_URL = env("REDIS_URL", required=True)
def inject_envs(): envs = {} envs['ROLLBAR_CLIENT_TOKEN'] = env('ROLLBAR_CLIENT_TOKEN') envs['SEGMENT_TOKEN'] = env('SEGMENT_TOKEN') envs['ENV'] = env('ENV') return {'ENV': envs}
from .settings import * from getenv import env if 'TRAVIS' in os.environ: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'travis_ci_test', 'USER': '******', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': os.getenv('PGPORT'), }, } ELASTICSEARCH_DSL = { 'default': { 'hosts': env('ELASTICSEARCH_TEST_HOST'), 'http_auth': env('ELASTICSEARCH_TEST_AUTH'), }, }
def _setup(path): os.environ['DJANGO_SETTINGS_MODULE'] = env( 'DJANGO_SETTINGS_MODULE', 'settings' )
# gmail sendmail config from getenv import env EMAIL_USE_TLS = True EMAIL_HOST = env('EMAIL_HOST') EMAIL_HOST_USER = env('EMAIL_HOST_USER') EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD') EMAIL_PORT = env('EMAIL_HOST_PORT', 587)
https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os from getenv import env # FIXME BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] AUTH_USER_MODEL = 'users.User' DATABASE_ROUTERS = ['settings.routing.LegacyRouter'] # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth',
import os from flask import Flask, render_template, got_request_exception from flask_sitemap import Sitemap import dotenv from getenv import env root_path = os.path.dirname(os.path.realpath(__file__)) + '/../' dotenv.read_dotenv(os.path.join(root_path, '.env')) app = Flask(__name__) app.debug = env('DEBUG') == 'true' app.config['SERVER_NAME'] = env('SERVER_NAME') app.config['SITEMAP_INCLUDE_RULES_WITHOUT_PARAMS'] = True app.config['SITEMAP_URL_SCHEME'] = 'https' ext = Sitemap(app=app) if env('ENV') == 'production': import rollbar import rollbar.contrib.flask @app.before_first_request def init_rollbar(): """init rollbar module""" rollbar.init( env('ROLLBAR_SERVER_TOKEN'), # environment name env('ENV'),
'coffin', 'debug_toolbar', 'disqus', 'djgeojson', 'flatblocks', 'leaflet', 'pipeline', 'south', # core 'colorado.apps.gundeaths', 'colorado.apps.news', ) # aws AWS_ACCESS_KEY_ID = env('AWS_ACCESS_KEY_ID') AWS_SECRET_ACCESS_KEY = env('AWS_SECRET_ACCESS_KEY') AWS_STORAGE_BUCKET_NAME = env('AWS_STORAGE_BUCKET_NAME') AWS_S3_SECURE_URLS = False AWS_QUERYSTRING_AUTH = False # api API_LIMIT_PER_PAGE = 0 TASTYPIE_FULL_DEBUG = True # caching and redis REDIS = dj_redis_url.config(default='redis://localhost:6379') CACHES = { 'default': { 'BACKEND': 'redis_cache.RedisCache',
import os from getenv import env import dj_database_url import ldap from django_auth_ldap.config import LDAPSearch, PosixGroupType # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PROJECT_DIR = os.path.dirname(__file__) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = env('SECRET_KEY', 'secret_key') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env('DEBUG', True) ALLOWED_HOSTS = ['localhost'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles',
# -*- coding: utf-8 -*- import os import logging import decimal import analytics from getenv import env from eloue.settings_utils import algolia_category_facets, \ algolia_category_attributes_for_faceting, agolia_category_facet_name local_path = lambda path: os.path.join(os.path.dirname(__file__), path) DEBUG = env('DEBUG', True) STAGING = env('STAGING', False) CLIENT_EXCEPTION_LOGGING = env('CLIENT_EXCEPTION_LOGGING', False) DEBUG_TOOLBAR = env('DEBUG_TOOLBAR', DEBUG) TEMPLATE_DEBUG = DEBUG DEBUG_TOOLBAR_PANELS = [ 'debug_toolbar.panels.versions.VersionsPanel', 'debug_toolbar.panels.timer.TimerPanel', 'debug_toolbar.panels.settings.SettingsPanel', 'debug_toolbar.panels.headers.HeadersPanel', 'debug_toolbar.panels.request.RequestPanel', 'debug_toolbar.panels.sql.SQLPanel', 'debug_toolbar.panels.staticfiles.StaticFilesPanel', 'debug_toolbar.panels.templates.TemplatesPanel', 'debug_toolbar.panels.cache.CachePanel', 'debug_toolbar.panels.signals.SignalsPanel', 'debug_toolbar.panels.logging.LoggingPanel', # 'debug_toolbar.panels.redirects.RedirectsPanel',
'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'ThermoApi.wsgi.application' # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': env('DB_NAME'), 'USER': env('DB_USER'), 'PASSWORD': env("DB_PASSWORD"), 'HOST': env("DB_HOST"), 'PORT': env("DB_PORT"), } } FIXTURE_DIRS = ( os.path.join(BASE_DIR, 'fixtures'), ) # Password validation # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
def __init__(self, user, api): self.username = user self.api_key = api self.api = drest.api.TastyPieAPI(env('API_DRF_HOST')) if self.username: self.api.auth(user, api)
# ----------------------------------------------------------------------------------- # RapidPro settings file for the docker setup # ----------------------------------------------------------------------------------- from getenv import env import dj_database_url import django_cache_url from datetime import datetime from django.utils.translation import ugettext_lazy as _ from django.conf.urls import include, url from temba.settings_common import * # noqa from django.urls import base AWS_QUERYSTRING_EXPIRE = '157784630' SUB_DIR = env('SUB_DIR', required=False) #Use CHAT_MODE_CHOICES to configure the chatmodes that are available to the Postmaster channel CHAT_MODE_CHOICES = (("WA", _("WhatsApp")), ("TG", _("Telegram")), ("SMS", _("SMS"))) if SUB_DIR is not None and len(SUB_DIR) > 0: MEDIA_URL = "{}{}".format(SUB_DIR, MEDIA_URL) MAILROOM_URL = env('MAILROOM_URL', 'http://localhost:8000') INSTALLED_APPS = ( INSTALLED_APPS + tuple(filter(None, env('EXTRA_INSTALLED_APPS', '').split(','))) + ('raven.contrib.django.raven_compat', ))
num_retries=5, num_retries_call=3, timeout=20) steem_ins.set_password_storage( 'environment') # Get Beem wallet pass from env var ``UNLOCK`` set_shared_steem_instance(steem_ins) # Set the shared Beem RPC instance to use the specified nodes # hive_ins = Hive(node=HIVE_RPC_NODES, num_retries=5, num_retries_call=3, timeout=20) # hive_ins.set_password_storage('environment') # Get Beem wallet pass from env var ``UNLOCK`` # set_shared_hive_instance(hive_ins) ######### # SteemEngine Handler Network related settings #### SENG_NETWORK_ACCOUNT = env('SENG_NETWORK_ACCOUNT', 'ssc-mainnet1') SENG_RPC_NODE = env('SENG_RPC_NODE', 'api.steem-engine.com') SENG_RPC_URL = env('SENG_RPC_URL', '/rpc/contracts') SENG_HISTORY_NODE = env('SENG_HISTORY_NODE', 'api.steem-engine.com') SENG_HISTORY_URL = env('SENG_HISTORY_URL', 'accounts/history') # Change to 'hive' to switch privex-steemengine to use beem with Hive RPCs instead of Steem RPCs SENG_NETWORK = env('SENG_NETWORK', 'steem') ######### # Bitshares Network related settings #### BITSHARES_RPC_NODE = env('BITSHARES_RPC_NODE', 'wss://eu.nodes.bitshares.ws')