Пример #1
0
 def handle(self, *args, **options):
     me = singleton.SingleInstance(flavor_id="crontw")
     m = '%s: Will run the Twitter harvester' % now.strftime('%y-%m-%d %H:%M')
     print(m)
     twitterLogger.log(m)
     try:
         harvestTwitter()
     except:
         myEmailMessage[0] = 'TWITTER HARVEST ROUTINE HAS ENCOUNTERED A TOP-LEVEL ERROR:'
         twitterLogger.exception(myEmailMessage[0])
     finally:
         print(myEmailTitle[0])
         print(myEmailMessage[0])
         twitterLogger.log("The harvest has ended for the Twitter harvesters",showTime=True)
         if not DEBUG:
             send_routine_email(myEmailTitle[0], myEmailMessage[0])
Пример #2
0
def log(*args, **kwargs):
    twitterLogger.log(*args, **kwargs)
from django.db import models
from django.db.utils import IntegrityError
from django.core.exceptions import MultipleObjectsReturned
import _mysql_exceptions
from SocialNetworkHarvester_v1p0.models import *
from django.utils.timezone import utc
import json
from datetime import datetime
import re

from SocialNetworkHarvester_v1p0.settings import twitterLogger, DEBUG
log = lambda s : twitterLogger.log(s) if DEBUG else 0
pretty = lambda s : twitterLogger.pretty(s) if DEBUG else 0
today = lambda : datetime.utcnow().replace(hour=0,minute=0,second=0,microsecond=0,tzinfo=utc)


############### PLACE ####################

class TWPlace(models.Model):
    _ident = models.CharField(unique=True, max_length=255)
    attributes = models.CharField(max_length=500, null=True)
    bounding_box = models.CharField(max_length=500, null=True)
    country = models.CharField(max_length=128, null=True)
    full_name = models.CharField(max_length=255, null=True)
    name = models.CharField(max_length=128, null=True)
    place_type = models.CharField(max_length=128, null=True)
    url = models.CharField(max_length=255, null=True)

    def get_fields_description(self):
        return {
            "_ident": {
Пример #4
0
from django.db import models
from django.db.utils import IntegrityError
from django.core.exceptions import MultipleObjectsReturned
import _mysql_exceptions
from SocialNetworkHarvester_v1p0.models import *
from django.utils.timezone import utc
import json
from datetime import datetime
import re, time

from SocialNetworkHarvester_v1p0.settings import twitterLogger, DEBUG
log = lambda s : twitterLogger.log(s) if DEBUG else 0
pretty = lambda s : twitterLogger.pretty(s) if DEBUG else 0
today = lambda : datetime.utcnow().replace(hour=0,minute=0,second=0,microsecond=0,tzinfo=utc)


############### PLACE ####################

class TWPlace(models.Model):
    _ident = models.CharField(unique=True, max_length=255)
    attributes = models.CharField(max_length=500, null=True)
    bounding_box = models.CharField(max_length=500, null=True)
    country = models.CharField(max_length=128, null=True)
    full_name = models.CharField(max_length=255, null=True)
    name = models.CharField(max_length=128, null=True)
    place_type = models.CharField(max_length=128, null=True)
    url = models.CharField(max_length=255, null=True)

    def get_fields_description(self):
        return {
            "_ident": {
def log(*args, **kwargs):
    twitterLogger.log(*args, **kwargs)