Merge branch 'nico/meow-pay-master' into HEAD
This commit is contained in:
commit
e4f2f446f5
75 changed files with 573 additions and 182 deletions
0
uncloud/uncloud_api/management/__init__.py
Normal file
0
uncloud/uncloud_api/management/__init__.py
Normal file
0
uncloud/uncloud_api/management/commands/__init__.py
Normal file
0
uncloud/uncloud_api/management/commands/__init__.py
Normal file
26
uncloud/uncloud_api/management/commands/hack.py
Normal file
26
uncloud/uncloud_api/management/commands/hack.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import time
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
import uncloud_api.models
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
import re
|
||||
|
||||
class Command(BaseCommand):
|
||||
args = '<None>'
|
||||
help = 'hacking - only use if you are Nico'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('command', type=str, help='Command')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
getattr(self, options['command'])(**options)
|
||||
|
||||
@classmethod
|
||||
def classtest(cls, **_):
|
||||
clsmembers = inspect.getmembers(sys.modules['uncloud_api.models'], inspect.isclass)
|
||||
for name, c in clsmembers:
|
||||
if re.match(r'.+Product$', name):
|
||||
print("{} -> {}".format(name, c))
|
||||
29
uncloud/uncloud_api/management/commands/snapshot.py
Normal file
29
uncloud/uncloud_api/management/commands/snapshot.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import time
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from uncloud_api import models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
args = '<None>'
|
||||
help = 'VM Snapshot support'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('command', type=str, help='Command')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
print("Snapshotting")
|
||||
#getattr(self, options['command'])(**options)
|
||||
|
||||
@classmethod
|
||||
def monitor(cls, **_):
|
||||
while True:
|
||||
try:
|
||||
tweets = models.Reply.get_target_tweets()
|
||||
responses = models.Reply.objects.values_list('tweet_id', flat=True)
|
||||
new_tweets = [x for x in tweets if x.id not in responses]
|
||||
models.Reply.send(new_tweets)
|
||||
except TweepError as e:
|
||||
print(e)
|
||||
time.sleep(60)
|
||||
Loading…
Add table
Add a link
Reference in a new issue