Business Objects XI SDK Example, Part 2 비즈니스 오브젝트 XI SDK를 예, 제 2 부
Continued from Business Objects XI SDK Example, part 1 비즈니스 오브젝트 XI SDK를 예, 1 부부터 계속
In this post, we'll go over how we can use a python script to process BO XI Java SDK CSV output. 이 게시물에서, 우리는 우리가 어떻게 볼로냐 XI의 Java SDK를 CSV 출력 처리하는 데 사용할 수있습니다 python 스크립트로 갈 거예요.
The python script makes an http request to the web app and receives the contents. Python 스크립트는 웹 애플 리케이션에있는 HTTP 요청을하고 내용을받습니다.
The configuration file stores information to email a report. 구성 파일을 저장하는 정보 보고서를 이메일로. It contains the following information: 그것은 다음과 같은 정보가 포함되어있습니다 :
#report-mailer.py
REMOVE_HEADER_ROW = True
#REMOVE_HEADER_ROW = False
COLUMN_SEPARATOR = " "
#COLUMN_SEPARATOR = ","
to = "noreply@noreply.com,noreply2@noreply.com "
sentfrom = "noreply@noreply.com"
User = "testuser "
Password = "password"
docIdentifier = "442005"
The contents of the config file should be self-explanatory. config 파일의 내용 자체 - 설명해야한다. It allows for the option of removing the header report from the dat 그것은 dat에서 보고서를 제거 헤더의 옵션을 허용
The "#" is the python comment symbol. "#"는 Python 주석 기호입니다.
Python is case sensitive. 파이썬은 대소문자를 구분합니다. Be aware of this when creating configuration files. 구성 파일을 만들 때 이것을 알고 있어야합니다.
The above code is read inline from the python script report-mailer.py (it is executable python code). 위의 코드는 python 스크립트는 보고서에서 인라인은 read - mailer.py (그것을 실행 파이썬 코드입니다). The config files sets the appropriate values that are needed by report-mailer.py. 보고서는 config 파일에서 필요로하는 적절한 값을 - mailer.py 세트.
Here's the contents of the python script: 여기 python 스크립트의 내용 :
( "\ n")
import sys
import smtplib
from email.MIMEText import MIMEText
import urllib
REMOVE_HEADER_ROW = True
COLUMN_SEPARATOR = " "
#COLUMN_SEPARATOR = ","
CSV_EXTRACT_URL = "http://dev1:8080/dpvalues/loginforward.jsp"
auth = "secEnterprise"
CMS = "ersdev1"
to = "noreply@noreply.com"
sentfrom = "noreply@noreply.com"
config_file = sys.argv[1]
#read in config info, and overwrite defaults set above
execfile(config_file)
params = urllib.urlencode({'CMS': CMS, 'User': User, 'Password': Password, 'auth':auth, 'docIdentifier':docIdentifier })
print str(params)
f = urllib.urlopen(CSV_EXTRACT_URL, params)
raw = f.read()
rows = raw.split("\n")
if REMOVE_HEADER_ROW:
rows = rows[1:]
buf = ""
for x in rows:
cln = x.strip()
if len(cln) < 3:
continue
sp = cln[1:-1].split('";"')
buf = COLUMN_SEPARATOR.join( sp ) "\n"
msg = MIMEText(buf)
msg['Subject'] = 'csv values'
msg['From'] = sentfrom
msg['To'] = to
s = smtplib.SMTP()
s.connect()
s.sendmail(sentfrom, [to], msg.as_string())
s.close() 분할
import sys
import smtplib
from email.MIMEText import MIMEText
import urllib
REMOVE_HEADER_ROW = True
COLUMN_SEPARATOR = " "
#COLUMN_SEPARATOR = ","
CSV_EXTRACT_URL = "http://dev1:8080/dpvalues/loginforward.jsp"
auth = "secEnterprise"
CMS = "ersdev1"
to = "noreply@noreply.com"
sentfrom = "noreply@noreply.com"
config_file = sys.argv[1]
#read in config info, and overwrite defaults set above
execfile(config_file)
params = urllib.urlencode({'CMS': CMS, 'User': User, 'Password': Password, 'auth':auth, 'docIdentifier':docIdentifier })
print str(params)
f = urllib.urlopen(CSV_EXTRACT_URL, params)
raw = f.read()
rows = raw.split("\n")
if REMOVE_HEADER_ROW:
rows = rows[1:]
buf = ""
for x in rows:
cln = x.strip()
if len(cln) < 3:
continue
sp = cln[1:-1].split('";"')
buf = COLUMN_SEPARATOR.join( sp ) "\n"
msg = MIMEText(buf)
msg['Subject'] = 'csv values'
msg['From'] = sentfrom
msg['To'] = to
s = smtplib.SMTP()
s.connect()
s.sendmail(sentfrom, [to], msg.as_string())
s.close()
import sys
import smtplib
from email.MIMEText import MIMEText
import urllib
REMOVE_HEADER_ROW = True
COLUMN_SEPARATOR = " "
#COLUMN_SEPARATOR = ","
CSV_EXTRACT_URL = "http://dev1:8080/dpvalues/loginforward.jsp"
auth = "secEnterprise"
CMS = "ersdev1"
to = "noreply@noreply.com"
sentfrom = "noreply@noreply.com"
config_file = sys.argv[1]
#read in config info, and overwrite defaults set above
execfile(config_file)
params = urllib.urlencode({'CMS': CMS, 'User': User, 'Password': Password, 'auth':auth, 'docIdentifier':docIdentifier })
print str(params)
f = urllib.urlopen(CSV_EXTRACT_URL, params)
raw = f.read()
rows = raw.split("\n")
if REMOVE_HEADER_ROW:
rows = rows[1:]
buf = ""
for x in rows:
cln = x.strip()
if len(cln) < 3:
continue
sp = cln[1:-1].split('";"')
buf = COLUMN_SEPARATOR.join( sp ) "\n"
msg = MIMEText(buf)
msg['Subject'] = 'csv values'
msg['From'] = sentfrom
msg['To'] = to
s = smtplib.SMTP()
s.connect()
s.sendmail(sentfrom, [to], msg.as_string())
s.close()
Continued on Business Objects XI SDK Example, part 3 비즈니스 오브젝트 XI SDK를 예, 부분은 3 일 연합 뉴스
Spread the word 확산 단어
del.icio.us Digg Furl Reddit del.icio.us Digg Digg에 추가 Furl furl Reddit
Trackback uri 트랙백 URI를
http://www.boguru.com/business-objects-xi-sdk-example-1-part-2/trackback/ http://www.boguru.com/business-objects-xi-sdk-example-1-part-2/trackback/



















2 Comments on Business Objects XI SDK Example, Part 2 » 비즈니스 오브젝트 XI SDK를 예, 제 2 부»에 2 개의 댓글
Business Objects XI Java SDK Example, Part 3 @ 1:25 pm (Pingback) 비즈니스 오브젝트 XI의 Java SDK를 예, 제 3 부 @ 오후 1시 25분 (Pingback)
[…] Continued from Business Objects XI Java SDK Example, Part 2 […] [...] 비즈니스 오브젝트 XI의 Java SDK를 예, 제 2 부 [...]에서 계속
Business Objects XI SDK Example, Part 1 @ 1:26 pm (Pingback) 비즈니스 오브젝트 XI SDK를 예, 제 1 부 @ 오후 1시 26분 (Pingback)
[…] in Business Objects XI SDK Example, Part 2 Filed under Business Objects SDK, Business Objects XI by […] [...] 비즈니스 오브젝트 XI SDK를 예, 제 2 부 비즈니스 오브젝트의 SDK는, 비즈니스 오브젝트 XI [소송에 ...]