def get(string, page): api = Api() return api.find(string, page, request)
from django.conf.urls import url from api.views import Api, Latest, getHist app_name = "api" urlpatterns = [ url(r'^$', Api.as_view(), name="api"), url(r'^latest/?$', Latest.as_view(), name="latest"), url(r'^([0-9]{4})-([0-9]{2})-([0-9]{2})/?', getHist.as_view(), name="historical") #url(r'^(?P<year>[0-9]{4})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})/?', getHist.as_view(), name="historical") ]
def index(): hosts = request.host_url.rstrip('/') api = Api() return api.urls(hosts)
def drop(): api = Api() return api.delete(request)
def post(): api = Api() return api.create(request)
from django.conf.urls import include, url from django.urls import path from django.contrib import admin from api.views import Api # admin.autodiscover() import game.views urlpatterns = [ url(r'^$', game.views.landing, name='landing'), path('admin/', admin.site.urls), path('game/', include('game.urls')), url(r'^api/', Api.as_view()) ]
import os from datetime import datetime, timedelta os.environ.update({"DJANGO_SETTINGS_MODULE": "vgsite.settings"}) import django django.setup() import requests from api.views import Api NOW = datetime.now() + timedelta(hours=8) print(NOW) print("===== vg todays card catch =====") if datetime.strftime(NOW, "%H:%M") == "09:31": Api("VG").get_vg_today_card() print("===== ws todays card catch =====") if datetime.strftime(NOW, "%H:%M") == "09:32": Api("WS").get_ws_today_card()