From e35c85dac4b77298fc8c886cb08316d032f08733 Mon Sep 17 00:00:00 2001 From: w Date: Tue, 12 Nov 2024 01:19:52 +0100 Subject: [PATCH] fix spacing and typos --- app/charts/asynchronous.py | 15 ++++----------- app/charts/views.py | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/app/charts/asynchronous.py b/app/charts/asynchronous.py index 288cf18..3eb582b 100644 --- a/app/charts/asynchronous.py +++ b/app/charts/asynchronous.py @@ -350,12 +350,12 @@ async def update_social_data(symbol): timeout=my_timeout ) - async with aiohttp.ClientSession(**client_args) as session: + async with aiohttp.ClientSession(**client_args) as session: # reddit data actions.append(asyncio.ensure_future(get_social_data(session, 'Monero'))) actions.append(asyncio.ensure_future(get_social_data(session, 'Bitcoin'))) actions.append(asyncio.ensure_future(get_social_data(session, 'Cryptocurrency'))) - + try: await asyncio.gather(*actions, return_exceptions=True) except asyncio.exceptions.TimeoutError: @@ -468,16 +468,9 @@ async def get_p2pool_data(session, mini): cell = 'A' + str(k + 3) wks.update_value(cell, datetime.datetime.strftime(p2pool_stat.date, '%Y-%m-%d')) print('spreadsheet updated') - else: + else: print('spreadsheet already with the latest data') return data - else: + else: return False return True - - - - - - - diff --git a/app/charts/views.py b/app/charts/views.py index e06760e..d3ffd4f 100644 --- a/app/charts/views.py +++ b/app/charts/views.py @@ -23,7 +23,7 @@ import asyncio import pygsheets from django.contrib.auth.decorators import login_required from requests import Session -from django.contrib.staticfiles.storage import staticfiles_storage +from django.contrib.staticfiles.storage import staticfiles_storage from charts.synchronous import get_history_function #################################################################################### @@ -39,7 +39,7 @@ locale.setlocale(locale.LC_ALL, 'en_US.utf8') # To be used when there's a problem with the API @login_required def add_coin(request): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') if request.method != 'POST': @@ -95,7 +95,7 @@ def add_coin(request): # Only authorized users can download all price data via URL request @login_required def get_history(request, symbol, start_time=None, end_time=None): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": #and request.user.username != "Morpheus": return render(request, 'users/error.html') count = get_history_function(symbol, start_time, end_time) @@ -113,7 +113,7 @@ def get_history(request, symbol, start_time=None, end_time=None): # Only authorized users can do this @login_required def load_rank(request, symbol): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') gc = pygsheets.authorize(service_file='service_account_credentials.json') sh = gc.open('zcash_bitcoin') @@ -146,7 +146,7 @@ def load_rank(request, symbol): # Only authorized users can do this @login_required def load_p2pool(request): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') count = 0 @@ -199,7 +199,7 @@ def load_p2pool(request): # Only authorized users can do this @login_required def load_dominance(request, symbol): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') gc = pygsheets.authorize(service_file='service_account_credentials.json') sh = gc.open('zcash_bitcoin') @@ -231,7 +231,7 @@ def load_dominance(request, symbol): # Only authorized users can do this @login_required def importer(request): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') count = 0 Social.objects.all().delete() @@ -288,7 +288,7 @@ def importer(request): # Only authorized users can do this @login_required def reset(request, symbol): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') Coin.objects.filter(name=symbol).all().delete() @@ -300,7 +300,7 @@ def reset(request, symbol): # Only authorized users can do this @login_required def populate_database(request): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') count = 0 @@ -754,7 +754,7 @@ def populate_database(request): # Only authorized users can do this @login_required def update_database_admin(request, date_from, date_to): - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') synchronous.update_database(date_from, date_to) @@ -762,7 +762,7 @@ def update_database_admin(request, date_from, date_to): message = 'Database updated from ' + str(date_from) + ' to ' + str(date_to) context = {'message': message} return render(request, 'charts/maintenance.html', context) - if request.user.username != "Administrador" and request.user.username != "Morpheus": + if request.user.username != "Administrator": return render(request, 'users/error.html') count = 0 @@ -5047,4 +5047,4 @@ def withdrawals(request): states.append(0) context = {'states': states, 'dates': dates} - return render(request, 'charts/withdrawals.html', context) \ No newline at end of file + return render(request, 'charts/withdrawals.html', context)