def main(): username = os.environ.get("NEOCITIES_USER") password = os.environ.get("NEOCITIES_PASS") api_key = os.environ.get("NEOCITIES_API_KEY") global nc nc = neocities.NeoCities(username, password, api_key) cli(obj={})
import time import sched import neocities import os import shutil from datetime import datetime, timedelta from tokens import neocitiesToken as nc nc = neocities.NeoCities('stonkman', nc) #Log into neocities account wipeTime = '23:00' #Wipe time in 24h format def wipeFiles(): #Wipe all local and neocities chart files for folder in os.listdir('./charts'): #Scans local directory to discover folders to delete nc.delete(folder) shutil.rmtree(f'./charts/{folder}') def scheduleWipe(): f = '%H:%M' #Time format timeNow = datetime.strftime(datetime.now(), f) #Current time in 24hr format timeUntil = (datetime.strptime(wipeTime, f) - datetime.strptime(timeNow, f)).total_seconds() #Time in seconds until wipeTime s = sched.scheduler(time.perf_counter, time.sleep) #Creates a scheduler s.enter(timeUntil, 1, wipeFiles) #Sets the scheduler to run wipeFiles at wipeTime
import os import generatebat import glob import neocities import sys # Remove current .web files for f in glob.glob("*.web"): os.remove(f) # Call spiders from batch file urls = open("callspiders.bat") while True: line = urls.readline() if not line: break os.system(line) urls.close() # Generates html import generator # Uploads to Neocities print("Uploading to Neocities...") nc = neocities.NeoCities(sys.argv[1], sys.argv[2]) nc.upload(('index.html', 'index.html'), ('style.css', 'style.css'))
def setUp(self): auth = (os.environ['NEOCITIES_USER'], os.environ['NEOCITIES_PASS']) self.nc = neocities.NeoCities(*auth)
def test_info_no_auth(self): self.nc = neocities.NeoCities() response = self.nc.info('blog') self.assertEqual(response['result'], 'success')
import neocities import os, sys #import config #path to the project folder/article folder path = ... #once in the right public folder, we can create a neocities object sewdtest = neocities.NeoCities(neocities_user, neocities_pwd) print('Deploying...') #for file in the folder; -- have to pass a tuple of name to be displayed on server and name of the file locally sewdtest.upload(('{filename}', '{filename}'))
from discord.ext import commands from datetime import datetime, timezone, timedelta from utils import tickerCheck as tc from chart import createChart as cc from editChart import chartEdit as ce from tokens import neocitiesToken as nc from tokens import apiKey headers = {'Content-Type': 'application/json'} stockOption = {'-c', '-v', '-r', '-d', '-i'} #Possible stock options ALPHA_API_KEY = apiKey['alpha'] #Grabs api keys TIINGO_API_KEY = apiKey['tiingo'] FINN_API_KEY = apiKey['finn'] nc = neocities.NeoCities('stonkman', nc) class stock(commands.Cog): def __init__(self, client): self.client = client @commands.command(aliases=['stonk'] ) #Establishes the 'stock' command with alias 'stonk' async def stock( self, ctx, ticker: typing.Optional[str] = 'invalid', *args ): #ticker -> stock option to search, args -> return modifiers url = tc(ticker) #Returns the NASDAQ URL of the ticker