Add PayFlow Pro wrapper to standard library?
Duncan Booth
me at privacy.net
Mon Feb 2 09:42:06 EST 2004
Mark McEahern <mark at mceahern.com> wrote in
news:mailman.1127.1075730146.12720.python-list at python.org:
> What I imagine is there would be a pure Python module that provides a
> high level interface to process transactions like this:
>
> import pfpro
> result = pfpro.process(details)
>
> This will then use a C wrapper to call the PayFlow Pro dynamic library.
>
> The Python wrapper would also support using the context functions:
>
> import pfpro
> context = pfpro.context(details)
> for tx in transactions:
> tx.result = context.process(tx.details)
>
> # context's __del__ could handle destroying itself, etc.
>
> What's the next step? I don't know since I've never been involved in
> adding anything to the standard library.
First off, forget about adding it to the standard library until a long way
down the line, if at all. This sounds like a useful but specialised module,
so it doesn't need to be shipped as standard.
Next, I suggest you have a look at Greg Ewing's Pyrex, which is a language
specifically for writing Python Extension modules. This should make your
life much easier than handling the C api directly. (There are plenty of
other options, but I prefer Pyrex).
Pyrex should make it easy for you to define an appropriate context type
directly in your extension module. This is probably a better solution than
trying to put a Python wrapper around a set of procedures as it means you
can control access to the C functions much more tightly.
More information about the Python-list
mailing list