Small error in api returns | API Development | TORN
Small error in api returns
  • FLAT cazylecious [2673048]cazylecious [2673048]
    • cazylecious [2673048]
    • Role: Civilian
    • Level: 50
    • Posts: 72
    • Karma: 23
    • Last Action: 1 minute
    • Quote
    • Report
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 13:49:46 - 22/07/21 (3 months ago)
    |
    Last replied 02:46:23 - 25/07/21 (2 months ago)

    As you can see, in the https://www.torn.com/api.html# page, when I look up faction/chains, my first result in the chains dictionary is '5996'
    but, if I attempt the code myself in an IDE:

    The '5996' chain is at the end, and the one at the end in the torn API page is at the beginning
    This isn't really very important, nor do I know if it's a problem on my end or something, but it wouldn't hurt to correct whatever is messing it up for the sake of consistency.
    Please correct me if I'm making some stupid mistake somewhere^^
  • TW* Stiny [992186]Stiny [992186]
    • Stiny [992186]
    • Role: Civilian
    • Level: 98
    • Posts: 365
    • Karma: 235
    • Last Action: 4 minutes
    • Quote
    • Report
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:05:20 - 24/07/21 (2 months ago)
    Post link copied to clipboard Copy post link
    Python automatically sorts the keys of a dictionary so it's putting it at the end for you by default since it's the lowest.
  • FLAT cazylecious [2673048]cazylecious [2673048]
    • cazylecious [2673048]
    • Role: Civilian
    • Level: 50
    • Posts: 72
    • Karma: 23
    • Last Action: 1 minute
    • Quote
    • Report
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 02:46:23 - 25/07/21 (2 months ago)
    Post link copied to clipboard Copy post link

    Stiny [992186]

    Python automatically sorts the keys of a dictionary so it's putting it at the end for you by default since it's the lowest.
    By that definition, the properties call should be sorted differently as well; however, the keys sorting in the docs and python is the same for properties, while it's reversed for chains.

    API docs being sorted in ascending order^.

    And this is python being sorted in ascending order as well

    Python in the chains call was sorted in the descending order, therefore, to me, I don't find any correlation between the sorting in python
Reply
Thread Title: