English flagItalian flagGerman flagSpanish flagFrench flagPortuguese flagRussian flag
IC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 비즈니스 오브젝트 XI SDK를 예, 제 2 부

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 스크립트의 내용 :

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()
( "\ 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()



Continued on Business Objects XI SDK Example, part 3 비즈니스 오브젝트 XI SDK를 예, 부분은 3 일 연합 뉴스

Permalink Print Comment 블로그 바로가기 인쇄 코멘트

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 개의 댓글

[…] Continued from Business Objects XI Java SDK Example, Part 2 […] [...] 비즈니스 오브젝트 XI의 Java SDK를 예, 제 2 부 [...]에서 계속

[…] in Business Objects XI SDK Example, Part 2 Filed under Business Objects SDK, Business Objects XI by […] [...] 비즈니스 오브젝트 XI SDK를 예, 제 2 부 비즈니스 오브젝트의 SDK는, 비즈니스 오브젝트 XI [소송에 ...]

Leave a Comment 코멘트를 남겨주




* *
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text . 당신이 한 사람 (스팸 스크립트), 유형의 보안 텍스트가 그림에 표시된 걸 증명하려면. 보시려면 여기를 클릭하세요 새로운 텍스트를 재생성합니다.
안티의 오디오 파일을 클릭 - 스팸 단어를 듣고