Exemplo n.º 1
0
 def __init__(self):
     super(StopSelectorWidget, self).__init__()
     
     #Initialize the frame and components
     self.ui = Ui_Frame()
     self.ui.setupUi(self)
     self.listWidget = self.ui.listWidget
     self.lineEdit = self.ui.lineEdit
     
     #Initialize the events
     QtCore.QObject.connect(self.lineEdit,QtCore.SIGNAL("textEdited(QString)"),self.changed)
     QtCore.QObject.connect(self.listWidget,QtCore.SIGNAL("activated(QModelIndex)"),self.selectedItem)
     QtCore.QObject.connect(self.ui.clearbtn,QtCore.SIGNAL("clicked()"),self.clear)
     
     #Initialize the internal status
     self.clear()
     
     
     #Initialize vasttrafik object 
     self.vast = Vasttrafik(get_key())
Exemplo n.º 2
0
 def __init__(self):
     QtGui.QMainWindow.__init__(self)
     self.ui = gui.Ui_MainWindow()
     self.ui.setupUi(self)
     
     self.stop_selector = StopSelectorWidget()
     self.from_selector = StopSelectorWidget()
     self.to_selector = StopSelectorWidget()
     
     self.stopList = self.ui.stopList
     self.tripList = self.ui.tripList
     self.dateTimeEdit = self.ui.dateTimeEdit
     
     self.ui.tripFormLayout.addRow('From',self.from_selector)
     self.ui.tripFormLayout.addRow('To',self.to_selector)
     self.ui.stopLayout.addWidget(self.stop_selector)
     
     
     self.stopList.headerItem().setText(0,'')
     self.stopList.headerItem().setText(1,'')
     self.stopList.headerItem().setText(2,'Direction')
     self.stopList.headerItem().setText(3,'Minutes')
     
     self.tripList.setColumnCount(5)
     self.tripList.headerItem().setText(0,'Departure')
     self.tripList.headerItem().setText(1,'')
     self.tripList.headerItem().setText(2,'Track')
     self.tripList.headerItem().setText(3,'Destination')
     self.tripList.headerItem().setText(4,'Arrival')
     
     
     QtCore.QObject.connect(self.stop_selector,QtCore.SIGNAL("selected()"),self.boardselected)
     QtCore.QObject.connect(self.from_selector,QtCore.SIGNAL("selected()"),self.stopselected)
     QtCore.QObject.connect(self.to_selector,QtCore.SIGNAL("selected()"),self.stopselected)
     
     now=datetime.now()
     min_date_time = QDateTime(now.year,now.month,now.day,now.hour,now.minute)
     
     self.dateTimeEdit.setMinimumDateTime(min_date_time)
     #Initialize vasttrafik object 
     self.vast = Vasttrafik(get_key())
Exemplo n.º 3
0
def sendtx(message):
    pri_key, pub_key = key.get_key()
    tx = transaction.create_tx(pub_key, pri_key, message)
    transaction.send_tx(tx)
Exemplo n.º 4
0
##CKIP
target_host = "140.116.245.151"
target_port = 2001

Attraction = ["附近", "周圍", "景點", "周邊"]
Food = ["美食", "吃", "好吃", "食物"]
Time = ["小時"]
Intro = ["介紹"]

app = Flask(__name__)

# get channel_secret and channel_access_token from your environment variable
#channel_secret = os.getenv('LINE_CHANNEL_SECRET','2b7d9859ceced4df8b4a55b367a2f8a2')
#channel_access_token = os.getenv('LINE_CHANNEL_ACCESS_TOKEN', 'BwaoWOUlEHd8jMTsZdgSgg78hs8JmJunlZolSEHgOhY6aNec43pRAney/8Us2vYCd9mYlFQO1YdbD9iR5XDeYK7G9PORoGm9yrcVsvP83ElL/iDkS8n8bpspgoGMbnMfr0bdj9cPBHvdSKTMpTSvlQdB04t89/1O/w1cDnyilFU=')
channel_secret, channel_access_token = key.get_key()
if channel_secret is None:
    print('Specify LINE_CHANNEL_SECRET as environment variable.')
    sys.exit(1)
if channel_access_token is None:
    print('Specify LINE_CHANNEL_ACCESS_TOKEN as environment variable.')
    sys.exit(1)

line_bot_api = LineBotApi(channel_access_token)
handler = WebhookHandler(channel_secret)


@app.route("/webhook", methods=['POST'])
def webhook():
    # get X-Line-Signature header value
    signature = request.headers['X-Line-Signature']
Exemplo n.º 5
0
            for ican in adata[country][state]:
                try:
                    outlist = get_forecast(path, key, ican)
                    outhist = open(path + 'history/' + ican + '_' + outlist[0][0] + '.csv', 'w')
                    outfile = open(path + ican + '.csv', 'w')
                    if len(outlist) > 0:
                        for idx in range(len(outlist)):
                            outfile.write(outlist[idx][0] + ';' + \
                                          str(outlist[idx][1]) + ';' + \
                                          str(outlist[idx][2]) + ';' + \
                                          str(outlist[idx][3]) + ';' + \
                                          str(outlist[idx][4]) + '\n')
                            outhist.write(outlist[idx][0] + ';' + \
                                          str(outlist[idx][1]) + ';' + \
                                          str(outlist[idx][2]) + ';' + \
                                          str(outlist[idx][3]) + ';' + \
                                          str(outlist[idx][4]) + '\n')
                    outfile.close()
                    outhist.close()
                    print(ican + ' is done.')
                except:
                    print(ican + ': data is not available.')
                time.sleep(7)

if __name__ == '__main__':
    import loadairports
    import key, os
    adata = loadairports.load_airports('../data/stations.csv')
    key = key.get_key('../data/stations.csv')
    saveforecast(os.getcwd() + '/../out/forecast/', adata, key)
Exemplo n.º 6
0
def extrct_auth2(auth2):
  from key import get_key
  key = get_key()
  f = Fernet(key.encode())
  user_pass_ = re.findall('\[\{username=(.+?)\}\].+\[\{password=(.+?)\}\]',f.decrypt(auth2.encode()).decode())[0]
  return user_pass_