Having some troubles getting the RC4 encrypted XML datafeed to interface with Python and am curious if any other users had any luck with it?
The site we're working on is Django driven, but I don't consider myself a Python expert. In attempting to port the PHP conversion script to Python I find myself banging my forehead on my desk quite often. Any help/suggestions would be appreciated.
Good question though. Could you post the code perhaps on our http://wiki.foxycart.com/integration section somewhere and we'll see if we can take a look at it?
Are you sure you're including the right libraries in order to get the RC4 functions in the first place? Perhaps a stupid question, but always good to start from the beginning.
Have you tried porting the "test post yourself an encrypted XML" script to python? That'd probably be a good first step.
We are succesfully able to encrypt and decrypt locally using our port of the PHP script. When testing with the foxycart XML datafeed we're saving the post data to a sqlite database and then decrypting from there. The decryption comes back as a garbled series of strange characters and question marks.
Here's the python code as we currently have it:
http://en.wikipedia.org/wiki/RC4#Implementation
I'll post the code to our wiki in moment; can't make our forum understand that, "In Python, whitespace is *very* important."
http://wiki.foxycart.com/integration:python
Included also is a FoxyData class that wraps up the decryption and parsing of a FoxyCart datafeed; it may be of some use.
Let us know if we can help further.
Here's a quick and dirty view in Django that saves the decrypted XML feed to a database. This assumes I placed the above code in a rc4.py at the myproject root and that I have an app named "accounts" with a "Data" model containing two fields - data and created_at: