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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

MikeKJ
(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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/62a0f7a2-f551-47e8-bb61-af88d275bc0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

gamesbook
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?

On Monday, 15 May 2017 17:06:09 UTC+2, MikeKJ wrote:
(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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/63c673c3-b1a0-4fcd-8a2c-5d0254cb4597%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Dartos
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

On Tuesday, May 16, 2017 at 9:40:44 AM UTC-4, Derek wrote:
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?

On Monday, 15 May 2017 17:06:09 UTC+2, MikeKJ wrote:
(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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/547d10fa-712a-475b-8bf2-bf59d26e08ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

James Schneider
In reply to this post by MikeKJ


On May 15, 2017 8:06 AM, "MikeKJ" <[hidden email]> 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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciV5u6LrziBCYJALHO0Y-yGhuxH2rCkX3PxA4ORheehsDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

MikeKJ
In reply to this post by MikeKJ
Thanks guys, yes it is SOAP and thank you for the pointer to suds-jurko library, making progress now

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3cde9658-3d93-4ab7-907a-5e5d13b6027f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.