test
This commit is contained in:
parent
48e7175b5e
commit
42c527dbe4
3 changed files with 32 additions and 25 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ venv/
|
||||||
*.sqlite3
|
*.sqlite3
|
||||||
migrations/
|
migrations/
|
||||||
service_account_credentials.json
|
service_account_credentials.json
|
||||||
|
settings.json
|
|
@ -14,17 +14,15 @@ import locale
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from operator import truediv
|
from operator import truediv
|
||||||
import pygsheets
|
import pygsheets
|
||||||
import feedparser
|
|
||||||
from requests import Session
|
from requests import Session
|
||||||
from psaw import PushshiftAPI #library Pushshift
|
from psaw import PushshiftAPI #library Pushshift
|
||||||
from django.contrib.staticfiles.storage import staticfiles_storage
|
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||||
|
|
||||||
locale.setlocale(locale.LC_ALL, 'en_US.utf8')
|
locale.setlocale(locale.LC_ALL, 'en_US.utf8')
|
||||||
|
|
||||||
api = PushshiftAPI()
|
api = PushshiftAPI()
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Próximos gráficos
|
# Useful Functions
|
||||||
###########################################
|
###########################################
|
||||||
|
|
||||||
def data_prep_posts(subreddit, start_time, end_time, filters, limit):
|
def data_prep_posts(subreddit, start_time, end_time, filters, limit):
|
||||||
|
@ -43,13 +41,16 @@ def data_prep_comments(term, start_time, end_time, filters, limit):
|
||||||
return pd.DataFrame(comments)
|
return pd.DataFrame(comments)
|
||||||
|
|
||||||
def get_latest():
|
def get_latest():
|
||||||
url = ''
|
with open("settings.json") as file:
|
||||||
|
data = json.load(file)
|
||||||
|
|
||||||
|
url = data["metrics_provider"][0]["price_url"]
|
||||||
parameters = {
|
parameters = {
|
||||||
'convert':'USD',
|
'convert':'USD',
|
||||||
}
|
}
|
||||||
headers = {
|
headers = {
|
||||||
'Accepts': 'application/json',
|
'Accepts': 'application/json',
|
||||||
'X-CMC_PRO_API_KEY': '',
|
data["metrics_provider"][0]["api_key_name"]: data["metrics_provider"][0]["api_key_value"],
|
||||||
}
|
}
|
||||||
|
|
||||||
session = Session()
|
session = Session()
|
||||||
|
@ -58,10 +59,10 @@ def get_latest():
|
||||||
try:
|
try:
|
||||||
response = session.get(url, params=parameters)
|
response = session.get(url, params=parameters)
|
||||||
data = json.loads(response.text)
|
data = json.loads(response.text)
|
||||||
print(data)
|
|
||||||
except (ConnectionError, Timeout, TooManyRedirects) as e:
|
except (ConnectionError, Timeout, TooManyRedirects) as e:
|
||||||
data = False
|
data = False
|
||||||
|
|
||||||
|
file.close()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def load_dominance(coin):
|
def load_dominance(coin):
|
||||||
|
@ -209,6 +210,7 @@ def index(request):
|
||||||
now_inflation = 0.001
|
now_inflation = 0.001
|
||||||
now_units = 0
|
now_units = 0
|
||||||
supply = 0
|
supply = 0
|
||||||
|
get_latest()
|
||||||
|
|
||||||
#load_dominance('xmr')
|
#load_dominance('xmr')
|
||||||
#load_rank('xmr')
|
#load_rank('xmr')
|
||||||
|
@ -3474,7 +3476,11 @@ def get_prices(symbol):
|
||||||
if getthem:
|
if getthem:
|
||||||
test = True
|
test = True
|
||||||
count = 1
|
count = 1
|
||||||
request = ''
|
data = ''
|
||||||
|
with open("settings.json") as file:
|
||||||
|
data = json.load(file)
|
||||||
|
file.close()
|
||||||
|
request = data["metrics_provider"][0]["metrics_url"] + symbol + data["metrics_provider"][0]["metrics"]
|
||||||
while test:
|
while test:
|
||||||
print('page ' + str(count))
|
print('page ' + str(count))
|
||||||
count += 1
|
count += 1
|
||||||
|
|
|
@ -29,12 +29,12 @@ STATICFILES_DIRS = [
|
||||||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = ''
|
SECRET_KEY = 'asdfasdfhasdfjasdf7ads7f7sd8fasdf7tasdfgasjhfgsjakgh'
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
#DEBUG = True
|
DEBUG = True
|
||||||
DEBUG = False
|
#DEBUG = False
|
||||||
STATIC_ROOT = "/var/www/moneropro/static/"
|
#STATIC_ROOT = "/var/www/moneropro/static/"
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['www.moneroj.net', 'localhost', '127.0.0.1', 'moneroj.net']
|
ALLOWED_HOSTS = ['www.moneroj.net', 'localhost', '127.0.0.1', 'moneroj.net']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue