Example #1
0
def create_connection_cursor():

    import pymysql as mysql
    user = readConfig('Mysql')['user']
    pswd = readConfig('Mysql')['pass']
    conn = mysql.connect(host='localhost', user=user, password=pswd, db='mantel')
    cur = conn.cursor()
    
    return conn, cur
# (c) Jansen A. Simanullang
# 28.01.2017 13:10:40 - 23.06.2017 15:34
# to be used with cron job scheduler
#---------------------------------------
# usage: NotifikasiATMMerput
# script name followed by nothing
#---------------------------------------

import os, sys, time, ConfigParser
import urllib, urllib2, pymysql
from operator import itemgetter
from BeautifulSoup import BeautifulSoup
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + "/"
from loadConfig import readConfig
atmproIP = readConfig("Atmpro")['ipaddress']
print "atmproIP = ", atmproIP
regionID = readConfig("Atmpro")['regionid']
print "regionID = ", regionID
regionName = readConfig("Atmpro")['regionname']
secretKey = readConfig("Telegram")['token']
Telebot = readConfig("Telegram")['username']
textLimit = int(readConfig("Telegram")['textlimit'])
behindProxy=int(readConfig("Internet")['behindproxy'])
dbhost = readConfig("Mysql")['host']
dbport = int(readConfig("Mysql")['port'])
dbuser = readConfig("Mysql")['user']
dbpass = readConfig("Mysql")['pass']
dbase = readConfig("Mysql")['dbase']
ucIndonesianFlag = u'\U0001F1EE\U0001F1E9'
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#---------------------------------------
# Python usage:
# ~$python NotifikasiTelegramATM
#---------------------------------------
lastEdit = "November 2017"
#---------------------------------------
import os, sys, time, ConfigParser
import urllib, urllib2, pymysql
from operator import itemgetter
from urllib import urlopen
from BeautifulSoup import BeautifulSoup
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + "/"
from loadConfig import readConfig
from helperlibrary import *
atmproIP = readConfig("Atmpro")['ipaddress']
regionID = readConfig("Atmpro")['regionid']
regionName = readConfig("Atmpro")['regionname']
jumlahKanca = int(readConfig("Atmpro")['jumlahkanca'])
secretKey = readConfig("Telegram")['token']
Telebot = readConfig("Telegram")['username']
testerTelegramID=readConfig("Telegram")['testertelegramid']
testingMode=int(readConfig("Telegram")['testingmode'])
textLimit = int(readConfig("Telegram")['textlimit'])
behindProxy=int(readConfig("Internet")['behindproxy'])
dbhost = readConfig("Mysql")['host']
dbport = int(readConfig("Mysql")['port'])
dbuser = readConfig("Mysql")['user']
dbpass = readConfig("Mysql")['pass']
dbase = readConfig("Mysql")['dbase']
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Example #4
0
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
#---------------------------------------
lastEdit = "Juni 2017"
#---------------------------------------
import os, sys, time, ConfigParser
import urllib, urllib2, pymysql
from operator import itemgetter
from urllib import urlopen
from BeautifulSoup import BeautifulSoup
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + "/"
from loadConfig import readConfig
atmproIP = readConfig("Atmpro")['ipaddress']
print "atmproIP = ", atmproIP
regionID = readConfig("Atmpro")['regionid']
print "regionID = ", regionID
regionName = readConfig("Atmpro")['regionname']
secretKey = readConfig("Telegram")['token']
Telebot = readConfig("Telegram")['username']
textLimit = int(readConfig("Telegram")['textlimit'])
behindProxy = int(readConfig("Internet")['behindproxy'])
dbhost = readConfig("Mysql")['host']
dbport = int(readConfig("Mysql")['port'])
dbuser = readConfig("Mysql")['user']
dbpass = readConfig("Mysql")['pass']
dbase = readConfig("Mysql")['dbase']
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# (c) Jansen A. Simanullang, 01.08.2016
# @BSD CITY: 11.08.2016 15:38
# @Medan City: June-August 2017
#---------------------------------------
# usage: python ATMRankByRUAH.py
#---------------------------------------
from BeautifulSoup import BeautifulSoup
import os, time, sys
import urllib2, xlwt, xlutils
from operator import itemgetter
from xlwt import *
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + "/"
from loadConfig import readConfig
from helperlibrary import *
regionID = readConfig("Atmpro")['regionid']
regionName = readConfig("Atmpro")['regionname']
jumlahKanca = int(readConfig("Atmpro")['jumlahkanca'])
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + os.sep

def welcomeScreen():

	if os.name == "posix":
		os.system("clear")
	else:
		os.system("cls")

	#print "TABULAR ATM RELIABILITY, UTILITY & AVAILABILITY \n\n\n"
#-------------------------------------------------------
def getTableContents(table):
# usage #1:
# ffetchStatusATMCL cro/uko/kode cabang
# script name followed by cro/uko or branchCode
# usage #2: ffetchStatusATMCL [cro/uko/kode cabang] [telegram_id]
# to send to telegram id directly
#---------------------------------------

from BeautifulSoup import BeautifulSoup
import os, sys, time
import urllib2
from operator import itemgetter
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + "/"
from loadConfig import readConfig
from helperlibrary import *
atmproIP = readConfig("Atmpro")['ipaddress']
regionID = readConfig("Atmpro")['regionid']
regionName = readConfig("Atmpro")['regionname']
secretKey = readConfig("Telegram")['token']
Telebot = readConfig("Telegram")['username']
textLimit = int(readConfig("Telegram")['textlimit'])
behindProxy = int(readConfig("Internet")['behindproxy'])
strHeaderLine = "\n----------------------------------------------\n"
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


def getTCashLow(table):

    soup = BeautifulSoup(str(table))

    rows = soup.findAll('tr')
Example #7
0
# (c) Jansen A. Simanullang, 11:15:55
# to be used with telegram-bot plugin
#---------------------------------------
# usage: fetchStatusATM 1234567
# script name followed by space and TID
#---------------------------------------

from BeautifulSoup import BeautifulSoup
import sys, time
import urllib2

from helperlibrary import *
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + "/"
from loadConfig import readConfig
regionID = readConfig("Atmpro")['regionid'].upper()
regionName = readConfig("Atmpro")['regionname']
strHeaderLine = "\n---------------------------------\n"
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


def getATMStats(table):

	soup = BeautifulSoup(str(table))
	
	rows = soup.findAll('tr')

	numRows = getRowsNumber(table)

	numCols = getColsNumber(table)
Example #8
0
# (c) Jansen A. Simanullang, 01.08.2016
# @BSD CITY: 11.08.2016 15:38
# @Medan City: 30.06.2017
#---------------------------------------
# usage: python ATMRankByRUA.py
#---------------------------------------
from BeautifulSoup import BeautifulSoup
import os, time, sys
import urllib2, xlwt, xlutils
from operator import itemgetter
from xlwt import *
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + "/"
from loadConfig import readConfig
from helperlibrary import *
regionID = readConfig("Atmpro")['regionid']
regionName = readConfig("Atmpro")['regionname']
jumlahKanca = int(readConfig("Atmpro")['jumlahkanca'])
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#---------------------------------------
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + os.sep


def welcomeScreen():

    if os.name == "posix":
        os.system("clear")
    else:
        os.system("cls")

    #print "TABULAR ATM RELIABILITY, UTILITY & AVAILABILITY \n\n\n"
# usage #1: 
# fetchStatusATMCO cro/uko/kode cabang
# script name followed by cro/uko or branchCode
#
# usage #2: fetchStatusATMCO [cro/uko/kode cabang] [telegram_id]
# to send to telegram id directly
#---------------------------------------
from BeautifulSoup import BeautifulSoup
import os, sys, time
import urllib2
from operator import itemgetter
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
scriptDirectory = os.path.dirname(os.path.abspath(__file__)) + "/"
from loadConfig import readConfig
from helperlibrary import *
atmproIP = readConfig("Atmpro")['ipaddress']
regionID = readConfig("Atmpro")['regionid']
regionName = readConfig("Atmpro")['regionname']
secretKey = readConfig("Telegram")['token']
Telebot = readConfig("Telegram")['username']
textLimit = int(readConfig("Telegram")['textlimit'])
behindProxy=int(readConfig("Internet")['behindproxy'])
strHeaderLine = "\n----------------------------------------------\n"
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
def getTCashOut(table):

	soup = BeautifulSoup(str(table))
	
	rows = soup.findAll('tr')

	numRows = getRowsNumber(table)