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"> Business Objects XI SDK Exemple, partie 2

Business Objects XI SDK Example, Part 2 Business Objects XI SDK Exemple, partie 2

Continued from Business Objects XI SDK Example, part 1 Suite de Business Objects XI SDK Exemple, partie 1

In this post, we'll go over how we can use a python script to process BO XI Java SDK CSV output. A ce poste, nous irons sur la façon dont nous pouvons utiliser un script Python pour le traitement de BO XI Java SDK CSV sortie.

The python script makes an http request to the web app and receives the contents. Le script python fait une requête http à l'application Web et reçoit le contenu.

The configuration file stores information to email a report. Le fichier de configuration stocke des informations de courrier électronique d'un rapport. It contains the following information: Il contient les informations suivantes:


#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. Le contenu du fichier de configuration doit être auto-explicatif. It allows for the option of removing the header report from the dat Il permet de supprimer l'option de l'en-tête du rapport dat

The "#" is the python comment symbol. Le "#" est le symbole de commentaire python.

Python is case sensitive. Python est sensible à la casse. Be aware of this when creating configuration files. Soyez conscients de ce moment de la création des fichiers de configuration.

The above code is read inline from the python script report-mailer.py (it is executable python code). Le code ci-dessus est en lecture en ligne du rapport de script python-mailer.py (il est exécutable code python). The config files sets the appropriate values that are needed by report-mailer.py. Les fichiers de configuration définit les valeurs appropriées qui sont nécessaires par rapport mailer.py-.

Here's the contents of the python script: Voici le contenu du 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()



Continued on Business Objects XI SDK Example, part 3 Suite sur Business Objects XI SDK Exemple, partie 3

Spread the word Passez le mot

del.icio.us Digg Furl Reddit del.icio.us Digg Furl Reddit

Permalink Print Comment Permalink Print Commentaire

Trackback uri Trackback 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 » 2 Commentaires sur Business Objects XI SDK Exemple, partie 2 »

[…] Continued from Business Objects XI Java SDK Example, Part 2 […] [...] Suite de Business Objects XI Java SDK Exemple, partie 2 [...]

[…] in Business Objects XI SDK Example, Part 2 Filed under Business Objects SDK, Business Objects XI by […] [...] Dans Business Objects XI SDK Exemple, partie 2 Classé sous Business Objects SDK, Business Objects XI par [...]

Leave a Comment Laissez un commentaire




* *
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 . Pour prouver que vous êtes une personne (pas un spam script), type de sécurité le texte figurant dans l'image. Cliquez ici pour regénérer un nouveau texte.
Cliquez pour écouter un fichier audio de l'anti-spam word