I was able to create a comm script to add the PO# to the 850's, but for the life of me I can't get the Invoice # on the 810's. Here is my code:
=====810in.py=====
import os
import time
import bots.botslib as botslib
import bots.botsglobal as botsglobal
from bots.botsconfig import *
def filename(channeldict,ta,filename):
ta.syn('botskey')
if ta.botskey:
return channeldict['filename'].replace('*',ta.botskey + '.XML')
else:
return filename
=====810 map=====
import decimal
import bots.transform as transform
import bots.botslib as botslib
import bots.botslib as botslib
InvoiceNum = inn.get({'BOTSID':X+'ReportDataSet'},{'BOTSID':X+'InvcHead',X+'InvoiceNum':None})
out.ta_info['botskey'] = InvoiceNum
out.put({'BOTSID':'ST'},{'BOTSID':'BIG','BIG02':InvoiceNum})
InvoiceNum shows up in the outbound EDI but it never appears appended to the filename (using the comm script above). I'm sure I'm missing something. I'm still new to the comm scripts (which are pretty cool by the way).
Steve Hammond
TCC
Cleburne, TX
-----Original Message-----
From:
bots...@googlegroups.com [mailto:
bots...@googlegroups.com] On Behalf Of henk-jan ebbers
Sent: Tuesday, May 22, 2012 6:13 AM
To:
bots...@googlegroups.com
Subject: Re: [Bots Open Source EDI Translator] Re: Channel using ftps
hi Jean-François,
just added code in communication/py that handles key files.
for now this is done a a user exit.
kind regards,
henk-jan
On 03/08/2012 01:34 PM, Jean-François Van Snick wrote:
> Hi Henk-Jan,
>
> No problem, I hope you enjoyed your holidays. I'll try it your way, but in the meantime, here's what we've done...
>
> I know modifiying Communication.py is not a good idea (for future releases& upgrades) - let's say it's quick& dirty, but it works (very well) :-)
>
> import ftplib27 #(ftplib27 is the ftplib from Python 2.7)
>
> class ftps(ftp):
> def connect(self):
> botslib.settimeout(botsglobal.ini.getint('settings','ftptimeout',10))
> if not hasattr(ftplib27,'FTP_TLS'): #use ftlib27 instead of ftplib
> raise botslib.CommunicationError('FTPS is not supported by your python version, use>=2.7')
> self.session = ftplib27.FTP_TLS() #use ftlib27 instead of ftplib
> self.session.set_debuglevel(botsglobal.ini.getint('settings','ftpdebug',0)) #set debug level (0=no, 1=medium, 2=full debug)
> self.session.set_pasv(not self.channeldict['ftpactive']) #active or passive ftp
> self.session.connect(host=self.channeldict['host'],port=int(self.channeldict['port']))
> #support key files (PEM, cert)?
> try: # under /usersys/ftps_keys directory containing private (key) and public (pem) keys -- keynames are channel_name+.key or .pem
> self.name_key = str(self.channeldict['idchannel'])+ '.key'
> self.name_pem = str(self.channeldict['idchannel'])+ '.pem'
> self.path_pem = os.path.join(self.channeldict['parameters'])+self.name_pem
> self.path_key = os.path.join(self.channeldict['parameters'])+self.name_key
> print self.path_pem
> print self.path_key
> self.session.keyfile = self.path_key
> self.session.certfile = self.path_pem
> except:
> pass
>
> self.session.auth()
> self.session.login(user=self.channeldict['username'],passwd=self.channeldict['secret'],acct=self.channeldict['ftpaccount'])
> self.session.prot_p()
> self.dirpath = self.session.pwd()
> if self.channeldict['path']:
> self.dirpath = posixpath.normpath(posixpath.join(self.dirpath,self.channeldict['path']))
> try:
> self.session.cwd(self.dirpath) #set right path on ftp-server
> except:
> self.session.mkd(self.dirpath) #set right path on ftp-server; no nested directories
> self.session.cwd(self.dirpath) #set right path on ftp-server
>
> Kind regards,
>
> JF
>
> On 08 Mar 2012, at 13:10,
hjeb...@gmail.com wrote:
>
>> hi Jean-François,
>>
>> sorry for my late reaction, slipped thru my mind (holidays etc).
>>
>> in a communication script you can subclass the class ftpis in communication.py
>> you only need the connect method.
>> best is probably to copy the existing connect() method in communication.py,
>> and introduce the private keys there.
>> you will need python 2.7
>> check out the python doc (ftplib)
>>
>> let me know if I can help.
>>
>> henk-jan ebbers
>>
>> On 02/22/2012 09:24 AM, Jean-François wrote:
>>> Hi Henk-Jan,
>>>
>>> Thanks for your answer. We're going to use implicit FTPS (port 990),
>>> but we'll need to handle the private key.
>>> Do you suggest to do that in a CommunicationScript? Do we have to
>>> check communication.py?
>>> Any clue appreciated :-)
>>>
>>> Kind regards,
>>>
>>> JF
>>>
>>> On 3 fév, 16:30, "
hjebb...@gmail.com"<
hjebb...@gmail.com> wrote:
>>>> hi Jean-Francois,
>>>>
>>>> I useFTPS
>>>> there are several variant ofFTPS, check this on eg wikipedia.
>>>> the implicit version does work but I do not use it is production (as a prject was aborted)
>>>>
>>>> untill now I did not need the keys directly, but it should be fairly easy to do that.
>>>>
>>>> henk-jan
>>>>
>>>> On 02/02/2012 05:20 PM, Jean-François wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Hi all,
>>>>> I do seeFTPSas a means of connection. Did anyone already use it? I
>>>>> see it requires Python>= 2.7, how about compatibility with Bots 2.0.X
>>>>> or 2.1?
>>>>> Where do we indicate/specify private and public keys?
>>>>> This is my next challenge with Bots :-)) Any help welcome.
>>>>> Kind regards
>>>>> JF
>