what on earth is this and how do I access 2 particular values to 2 keys

32 views
Skip to first unread message

MikeKJ

unread,
May 15, 2017, 11:06:09 AM5/15/17
to Django users
(cardInfo){
   ShellData =
      (ShellData){
         availableShellActions[] =
            "CHANGE_SHELL_ITERATION_NUMBER",
            None,
            "IPE_FULFILMENT",
            "LIST_SHELL",
            None,
         isrn = ""
         products[] =
            (Product){
               parameters =
                  (parameters){
                     entry[] =
                        (entry){
                           key = "autoRenewThreshold"
                        },
                        (entry){
                           key = "validityCode"
                           value = "0"
                        },
                        (entry){
                           key = "lastTransactionDate"
                           value = "2017-05-15T11:13:00+01:00"
                        },
                        (entry){
                           key = "countRemaining"
                           value = "10"
                        },
                  }
                }
          },
 }

I want to access the values for the keys lastTransactionDate and countRemaining
As far as I can see there are lists within dicts and dicts within dicts

Derek

unread,
May 16, 2017, 9:40:44 AM5/16/17
to Django users
That does not appear to be a valid Python structure; I assume its generated by some third-party process - perhaps try and get it from them as a valid JSON file?

Dartos

unread,
May 16, 2017, 3:45:08 PM5/16/17
to Django users
It could be SOAP:
http://www.service-architecture.com/articles/web-services/soap.html

If so, there's a python package suds-jurko you can install with pip.

See here for documentation:
https://bitbucket.org/jurko/suds/wiki/Original%20Documentation

This snippet from the documentation appears similar to your example above:
(Person)=
 
{
    phone
= []
    age
= NONE
    name
(Name) =
       
{
           
last = NONE
            first
= NONE
       
}
   
}

Dartos

James Schneider

unread,
May 16, 2017, 5:22:06 PM5/16/17
to django...@googlegroups.com


On May 15, 2017 8:06 AM, "MikeKJ" <mike....@paston.co.uk> wrote:
(cardInfo){
   ShellData =
      (ShellData){
         availableShellActions[] =
            "CHANGE_SHELL_ITERATION_NUMBER",
            None,
            "IPE_FULFILMENT",
            "LIST_SHELL",
            None,
         isrn = ""
         products[] =
            (Product){
               parameters =


<snip>

This "appears" to be a print() of a SOAP API response generated by a library such as suds. Without information about where it came from or how you got it, I can't be sure.

If that's the case, the structure will act like a dict and a list where appropriate. For example:

(cardInfo){ indicates a dict member with a key of 'cardinfo' that contains another dict.

products[] = indicates a dict member named 'products' that contains a list of other elements.

If it is the suds library, I'd recommend using the suds-jurko fork, since the original library appears to be abandoned. It's a drop-in replacement.

Just a guess...

-James

MikeKJ

unread,
May 17, 2017, 5:12:26 AM5/17/17
to Django users
Thanks guys, yes it is SOAP and thank you for the pointer to suds-jurko library, making progress now
Reply all
Reply to author
Forward
0 new messages