fix spacing and typos

This commit is contained in:
w 2024-11-12 01:19:52 +01:00
parent 795430c0ba
commit e35c85dac4
2 changed files with 16 additions and 23 deletions

View file

@ -350,12 +350,12 @@ async def update_social_data(symbol):
timeout=my_timeout timeout=my_timeout
) )
async with aiohttp.ClientSession(**client_args) as session: async with aiohttp.ClientSession(**client_args) as session:
# reddit data # reddit data
actions.append(asyncio.ensure_future(get_social_data(session, 'Monero'))) 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, 'Bitcoin')))
actions.append(asyncio.ensure_future(get_social_data(session, 'Cryptocurrency'))) actions.append(asyncio.ensure_future(get_social_data(session, 'Cryptocurrency')))
try: try:
await asyncio.gather(*actions, return_exceptions=True) await asyncio.gather(*actions, return_exceptions=True)
except asyncio.exceptions.TimeoutError: except asyncio.exceptions.TimeoutError:
@ -468,16 +468,9 @@ async def get_p2pool_data(session, mini):
cell = 'A' + str(k + 3) cell = 'A' + str(k + 3)
wks.update_value(cell, datetime.datetime.strftime(p2pool_stat.date, '%Y-%m-%d')) wks.update_value(cell, datetime.datetime.strftime(p2pool_stat.date, '%Y-%m-%d'))
print('spreadsheet updated') print('spreadsheet updated')
else: else:
print('spreadsheet already with the latest data') print('spreadsheet already with the latest data')
return data return data
else: else:
return False return False
return True return True

View file

@ -23,7 +23,7 @@ import asyncio
import pygsheets import pygsheets
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from requests import Session 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 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 # To be used when there's a problem with the API
@login_required @login_required
def add_coin(request): 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') return render(request, 'users/error.html')
if request.method != 'POST': if request.method != 'POST':
@ -95,7 +95,7 @@ def add_coin(request):
# Only authorized users can download all price data via URL request # Only authorized users can download all price data via URL request
@login_required @login_required
def get_history(request, symbol, start_time=None, end_time=None): 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') return render(request, 'users/error.html')
count = get_history_function(symbol, start_time, end_time) 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 # Only authorized users can do this
@login_required @login_required
def load_rank(request, symbol): 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') return render(request, 'users/error.html')
gc = pygsheets.authorize(service_file='service_account_credentials.json') gc = pygsheets.authorize(service_file='service_account_credentials.json')
sh = gc.open('zcash_bitcoin') sh = gc.open('zcash_bitcoin')
@ -146,7 +146,7 @@ def load_rank(request, symbol):
# Only authorized users can do this # Only authorized users can do this
@login_required @login_required
def load_p2pool(request): 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') return render(request, 'users/error.html')
count = 0 count = 0
@ -199,7 +199,7 @@ def load_p2pool(request):
# Only authorized users can do this # Only authorized users can do this
@login_required @login_required
def load_dominance(request, symbol): 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') return render(request, 'users/error.html')
gc = pygsheets.authorize(service_file='service_account_credentials.json') gc = pygsheets.authorize(service_file='service_account_credentials.json')
sh = gc.open('zcash_bitcoin') sh = gc.open('zcash_bitcoin')
@ -231,7 +231,7 @@ def load_dominance(request, symbol):
# Only authorized users can do this # Only authorized users can do this
@login_required @login_required
def importer(request): def importer(request):
if request.user.username != "Administrador" and request.user.username != "Morpheus": if request.user.username != "Administrator":
return render(request, 'users/error.html') return render(request, 'users/error.html')
count = 0 count = 0
Social.objects.all().delete() Social.objects.all().delete()
@ -288,7 +288,7 @@ def importer(request):
# Only authorized users can do this # Only authorized users can do this
@login_required @login_required
def reset(request, symbol): 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') return render(request, 'users/error.html')
Coin.objects.filter(name=symbol).all().delete() Coin.objects.filter(name=symbol).all().delete()
@ -300,7 +300,7 @@ def reset(request, symbol):
# Only authorized users can do this # Only authorized users can do this
@login_required @login_required
def populate_database(request): 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') return render(request, 'users/error.html')
count = 0 count = 0
@ -754,7 +754,7 @@ def populate_database(request):
# Only authorized users can do this # Only authorized users can do this
@login_required @login_required
def update_database_admin(request, date_from, date_to): 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') return render(request, 'users/error.html')
synchronous.update_database(date_from, date_to) 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) message = 'Database updated from ' + str(date_from) + ' to ' + str(date_to)
context = {'message': message} context = {'message': message}
return render(request, 'charts/maintenance.html', context) 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') return render(request, 'users/error.html')
count = 0 count = 0
@ -5047,4 +5047,4 @@ def withdrawals(request):
states.append(0) states.append(0)
context = {'states': states, 'dates': dates} context = {'states': states, 'dates': dates}
return render(request, 'charts/withdrawals.html', context) return render(request, 'charts/withdrawals.html', context)