我已将twitter套件与Fabric插件集成,并使用以下代码完成了Twitter初始化
import requests
import time
import threading
from requests_ntlm import HttpNtlmAuth
from BeautifulSoup import BeautifulSoup, Comment
from datetime import date, timedelta , datetime
import smtplib
from smtplib import SMTPException
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import ConfigParser
import ast
import logging
logging.basicConfig(level=logging.DEBUG)
def send_email(sender, sender_password, receiver, message):
print("sending email...")
try:
mail_session = smtplib.SMTP('smtp.gmail.com',587)
mail_session.ehlo()
mail_session.starttls()
mail_session.ehlo()
mail_session.login(sender, sender_password)
mail_session.sendmail(sender,receiver,message)
mail_session.quit()
print "Successfully sent email"
except smtplib.SMTPException , e:
print "Error: unable to send email" + str(e)
except smtplib.SMTPAuthenticationError:
print "SMTPAuthenticationError" + str(e)
except smtplib.SMTPConnectError:
print "SMTPConnectError" + str(e)
#Read From config.ini
config = ConfigParser.ConfigParser()
config.read('config.ini')
config.sections()
sender = ast.literal_eval(config.get('general', 'sender_email'))
sender_password = ast.literal_eval(config.get('general', 'sender_password'))
receiver = ast.literal_eval(config.get('general', 'receiver_email'))
subject_ticket = ast.literal_eval(config.get('general', 'subject_email_ticket'))
subject_no_ticket = ast.literal_eval(config.get('general', 'subject_email_noticket'))
subject_error = ast.literal_eval(config.get('general', 'subject_email_error'))
username = ast.literal_eval(config.get('general', 'username'))
password = ast.literal_eval(config.get('general', 'password'))
while True:
# Getting all tickets created
session = requests.Session()
session.auth = HttpNtlmAuth('DOMAIN\\' + username, password, session)
try:
print("call 1")
response = session.get('http://10.1.10.227/iwebpro/')
except:
print("no success")
try:
print("call 2")
response = session.get('http://10.1.10.227/iwebpro/HDA/Logon/Logon.aspx')
except:
print("no success on LOGIN")
payload = {
'Data' : '{UwBFAEwARQBDAFQAIABhAC4ASQBEAFAAcgBvAHQAbwBjAG8AbABsAG8AIABBAFMAIABUAGkAYwBrAGUAdABJAEQALAAgAEEALgBJAEQAUAByAG8AdABvAGMAbwBsAGwAbwAgAEE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cABpACAAZAAgAHcAaQB0AGgAKABuAG8AbABvAGMAawApACAATwBOACAAKABhAC4AVABpAHAAbwAgAD0AIABkAC4ASQBEAFQAaQBwAG8AKQAgACAATABFAEYAVAAgAEoATwBJAE4AIABUAEEAQgBDAGgAaQBhAG0AYQB0AGUAVABpAHAAaQAgAGQAMQAgAHcAaQB0AGgAKABuAG8AbABvAGMAawApACAATwBOACAAKABkAC4ASQBEAFAAcgBvAHQAbwBjAG8AbABsAG8AUABhAGQAcgBlACAAPQAgAGQAMQAuAEkARABUAGkAcABvACkAIAAgAEwARQBGAFQAIABKAE8ASQBOACAAVABBAEIAUAByAGkAbwByAGkAdABhACAAZQAgAHcAaQB0AGgAKABuAG8AbABvAGMAawApACAATwBOACAAKABhAC4AVQByAGcAZQBuAHoAYQAgAD0AIABlAC4ASQBEAFAAcgBpAG8AcgBpAHQAYQApACAAIABMAEUARgBUACAASgBPAEkATgAgAFQAQQBCAEEAcwBzAGUAdABzAF8ASABhAHIAZAB3AGEAcgBlACAAZgAgAHcAaQB0AGgAKABuAG8AbABvAGMAawApACAATwBOACAAKABhAC4ASQBEAFAAcgBvAHQAbwBjAG8AbABsAG8ASABhAHIAZAB3AGEAcgBlACAAPQAgAGYALgBJAEQAUAByAG8AdABvAGMAbwBsAGwAbwAgAGEAbgBkACAAaQBzAG4AdQBsAGwAKABkAC4AbQB1AGwAdABpAGEAcwBzAGUAdAAsADAAKQA9ADAAKQAgAEwARQBGAFQAIABKAE8ASQBOACAAVABBAEIASABEAEEATQBhAGkAbABfAE0AYQBpAGwAQgBvAHgAZQBzACAAZwAgAHcAaQB0AGgAKABuAG8AbABvAGMAawApACAATwBOACAAKABhAC4ASQBEAG0AYQBpAGwAQgBvAHgAIAA9ACAAZwAuAEkARABNAGEAaQBsAEIAbwB4ACkAIAAgAEwARQBGAFQAIABKAE8ASQBOACAAVABBAEIASABEAEEATQBhAGkAbABfAE0AYQBpAGwAQgBvAHgAZQBzACAAaAAgAHcAaQB0AGgAKABu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8AKQAgAD0AIABmAG4AUgBlAHMALgBJAEQAUgBlAHMAZwByAG8AdQBwACkAIABXAEgARQBSAEUAIAAxAD0AMQAgACAAYQBuAGQAIABpAHMAbgB1AGwAbAAoAGEALgBJAEQATQBhAGkAbABiAG8AeAAsACcAJwApACAASQBOACAAKABTAEUATABFAEMAVAAgAEkARABNAGEAaQBsAGIAbwB4ACAARgBSAE8ATQAgAGYAbgBIAEQAQQBOAEUAVABfAEcAZQB0AE0AYQBpAGwAYgBvAHgATABpAHMAdAAoACcAUAAxADAAOQA1AEMAJwAsADEAKQApACAAIABBAE4ARAAgAGEALgBJAEQAUwB0AGEAdABvACAASQBOACAAKAAgACcAUwAxACcAKQAgACAAQQBOAEQAIAAoADEAPAA+ADEAIABPAFIAIABJAFMATgBVAEwATAAoAGEALgBJAEQAUABlAHIAcwBvAG4AYQBsAGUALAAgAGEALgBJAEQARwByAHUAcABwAG8AKQAgAEkATgAgACgAIAAnAFAAMQAwADkANQBDACcALAAgACcARwAxADYAMwBDACcALAAgACcARwAxADYAOABDACcAKQAgACkAIAA=}',
'Encoded': '1',
'IDExcelTemplate': 'STD_1',
'IsPreview': '1',
'Type': '1'
}
headers = {
'User-Agent':'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E)',
'Content-Type':'application/x-www-form-urlencoded',
'Host': '10.1.10.227',
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'it-IT, it; q=0.5',
'Cache-Control': 'no-cache',
'Connection': 'Keep-Alive',
}
try:
print("call 3")
response2 = session.post('http://10.1.10.227/iwebpro/HDA/Excel/ExcelPreview.aspx', data=payload, headers=headers)
except Exception as e:
print (e)
print("no success on POST")
# print (response2.text)
#if call is not successfull
if response2.status_code == 200 :
# Filter tickets which is created in last x minutes
t = response2.text
results = {}
bs = BeautifulSoup(t)
results = {}
for row in bs.findAll('tr'):
aux = row.findAll('td')
if str(aux[7].string) != 'None':
d = datetime.strptime(str(aux[7].string), "%d/%m/%Y %H.%M.%S")
difference = datetime.today() - d
#print difference.days #days
#print divmod(difference.seconds, 3600)[0] # hours
#print divmod(difference.seconds, 60)[0] # Minutes
if difference.days == 0 and divmod(difference.seconds, 60)[0] <= 31:
results[str(aux[0].string)] = [str(d),str(aux[6].string),str(aux[2].string)]
print results
# Sending result as an email
if(bool(results)):
body = 'New Tickets have been created:\n\n'
for x in results:
body = body + ' - ID ' + x + ' created on ' + results[x][0] + ' for "'+ results[x][1] + '" with subject of "'+ \
results[x][2] +'"\n'
body = body + '\nBest Regards, \nAutomatic Script'
msg = MIMEMultipart()
msg['From'] = sender
msg['To'] = receiver
msg['Subject'] = str(time.time()) + subject_ticket
msg.attach(MIMEText(body, 'plain'))
message = str(msg)
#send an email
send_email(sender, sender_password, receiver, message)
else:
print "No new ticket"
body = 'There is no new ticket'
msg = MIMEMultipart()
msg['From'] = sender
msg['To'] = receiver
msg['Subject'] = str(time.time()) + subject_no_ticket
msg.attach(MIMEText(body, 'plain'))
message = str(msg)
send_email(sender, sender_password, receiver, message)
time.sleep(30*60)
我还从面料仪表板添加了回调网址,但我仍然得到auth失败错误,下面是我的日志猫
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(getApplicationContext(), new Twitter(authConfig));
答案 0 :(得分:0)
将您的TWITTER_KEY替换为fabric提供的CONSUMER KEY(API KEY)和使用CONSUMER Secret(API KEY)的TWITTER_SECRET。
替换
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
带
TwitterAuthConfig authConfig = new TwitterAuthConfig("Insert Consumer key here(CONSUMER KEY (API KEY))", Insert consumer secret key here(CONSUMER Secret (API KEY)));