Business Objects XI SDK Example, Part 2 الأعمال SDK مثال الكائنات الحادي عشر ، الجزء 2
Continued from Business Objects XI SDK Example, part 1 وواصلت من الأعمال SDK مثال الكائنات الحادي عشر ، الجزء 1
In this post, we'll go over how we can use a python script to process BO XI Java SDK CSV output. في هذا المنصب ، ونحن نذهب الى ما يزيد على الطريقة التي يمكننا استخدام بيثون السيناريو الفرعي لعملية الحادي عشر جافا SDK CSV الانتاج.
The python script makes an http request to the web app and receives the contents. الثعبان ويجعل النص المتشعب الطلب الى الشبكة العالمية ، وتتلقى الوكالة مضمون.
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. محتويات للملف يجب أن لا تحتاج إلى شرح. It allows for the option of removing the header report from the dat وهو يتيح خيار رفع رأس تقريرا من دات
The "#" is the python comment symbol. "#" الثعبان رمز التعليق.
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). أعلاه رمز المحول من قراءة السيناريو الثعبان وبين التقرير mailer.py (بيثون انها رمز للتنفيذ). The config files sets the appropriate values that are needed by report-mailer.py. فإن ملفات يحدد القيم المناسبة التي يحتاج إليها التقرير بين mailer.py.
Here's the contents of the python script: وإليك محتويات الثعبان والكتابة :
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 واستمر العمل SDK مثال الكائنات الحادي عشر ، الجزء 3
Spread the word انتشار كلمة
Trackback uri Trackback أوري
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 » 2 تعليقات على الأعمال SDK مثال الكائنات الحادي عشر ، الجزء 2 »
Business Objects XI Java SDK Example, Part 3 @ 1:25 pm (Pingback) حادي عشر الأجسام الأعمال جافا SDK مثال ، الجزء 3 @ 1:25 مساء (Pingback)
[…] Continued from Business Objects XI Java SDK Example, Part 2 […] [...] من استمرار الأعمال الأجسام جافا SDK مثال الحادي عشر ، الجزء 2 [...]
Business Objects XI SDK Example, Part 1 @ 1:26 pm (Pingback) الأعمال SDK مثال الكائنات الحادي عشر ، الجزء 1 @ 1:26 مساء (Pingback)
[…] in Business Objects XI SDK Example, Part 2 Filed under Business Objects SDK, Business Objects XI by […] [...] في الأعمال SDK مثال الكائنات الحادي عشر ، الجزء 2 المحفوظة في إطار الأعمال الأجسام SDK ، الشركات الأجسام الحادية عشرة من قبل [...]