Exemplo n.º 1
0
	def __init__(self, user, consumer_key, consumer_secret):
		self.auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
		usr = tweepy.API(self.auth).get_user(screen_name=user)
		self.user = str(usr.id)
		self.url = ''
		self.data = config.loadData()
		self.dt = { }
Exemplo n.º 2
0
Pre-trained models already exist.
No need to run model2.py if predict output.
Please backup the existed method 2 models before running model2.py! 
'''

# Create Dir to same model1 (if not exist)
path = './model/model2'
if not os.path.exists(path):
    os.makedirs(path)
sys.stdout.write("0%\r")
sys.stdout.flush()

############ Load Training Data set ############

data_sample, data_output = loadData()
data_sample = data_sample.values.tolist()
sys.stdout.write("10%\r")
sys.stdout.flush()

############ Preprocess of Sample Data set ############


def data_flag(data_out):
    flag = data_out[:][0].tolist()
    return flag


def data_seq(data_out):
    data_out = data_out[:][1]
    split = data_out.str.split(':', expand=True)
Exemplo n.º 3
0
import email
import config
import string
import rfc822
import imaplib
import smtplib
import datetime
import StringIO
import email.utils
from email.mime.text import MIMEText

configt = config.loadData()

class MailSpider():
	
	def __init__(self, user, password):
		self.user = user
		self.passwd = password
		
		try:
			self.mail = imaplib.IMAP4_SSL(configt['social']['imap_server'], configt['social']['imap_port'])
			self.mail.login(user, password)
		except Exception, e:
			print e

	def __del__(self):
		self.mail.logout()
		
	def __parse_email(self, raw_addres):
		return string.lower(email.utils.parseaddr(raw_addres)[1])
	
Exemplo n.º 4
0
Arquivo: shareip.py Projeto: F3DS/f3ds
import json
import tweepy
import config
import urllib2
import hashlib
import binascii
import threading
import mailspider
import sqlalchemy
import twitterspider
import facebookspider
import socialdistance
from sqlalchemy.orm import create_session
from sqlalchemy.ext.declarative import declarative_base

data = config.loadData()

db = sqlalchemy.create_engine(data["db"]["mysql_connection"])
metadata = sqlalchemy.MetaData(db)
Base = declarative_base()


class SocialPeer(Base):
    __table__ = sqlalchemy.Table("socialpeers", metadata, autoload=True)


def get_ip():
    return urllib2.urlopen(data["social"]["url_get_ip"]).read()


def get_message(user):
Exemplo n.º 5
0
	def __init__(self, user):
		self.data = config.loadData()
		self.user = hashlib.md5(user.upper()).hexdigest()
		self.token_fb = ''
		self.code = ''
		self.url = ''
Exemplo n.º 6
0
8.Type model of 3rd sequence
9.D sequence model of 3rd sequence

Pre-trained models already exist.
No need to run model1.py if predict output.
Please backup the existed method 1 models before running model1.py! 
'''

# Create Dir to same model1 (if not exist)
path = './model/model1'
if not os.path.exists(path):
    os.makedirs(path)

############ Load Training Data set ############

inputs, output = loadData()
sys.stdout.write("10%\r")

############ Preprocess of Sample Data set ############

# Feature data
output_number = output[:][0]

# Type of first sequence
input_new = pd.concat([inputs, output[:][0]], axis=1)
output_seq = output[:][1]
output_seq_new = output_seq.str.split(':', expand=True)
output_new = output_seq_new[[0]]

# Divide Train set and Output set
output_seq_split = output_seq.str.split(':', expand=True)