Julenho / twitter_log

envio de logs no
0 stars 0 forks source link

gerenciador pip #4

Open Julenho opened 4 years ago

Julenho commented 4 years ago

apt install python-pip pip install tweepy

Julenho commented 4 years ago

!/usr/bin/python2.7

import tweepy import csv

f3 = csv.reader(open("/tmp/acessostw.csv","r")) msg = '' consumer_key = "xxxxxxxxxxxxxxx" consumer_secret = "xxxxxxxxxxxxxxxx" access_token = 'xxxxxxxxxxxxxxxx' access_token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) myapi = tweepy.API(auth)

for x in f3: lista_x = str(x).split() l_lista = len(lista_x)

    for y in range(l_lista):
            data = lista_x[2]+'/'+lista_x[1]+', '+'Hora: '+lista_x[3]
            porta = lista_x[9]
            ip = lista_x[13]
    mensag = data+', '+porta+', '+ip+'\n'
    msg += mensag

myapi.update_status(msg)