Page 85 of 97

PostPosted: Wed Oct 07, 2020 10:44 pm
by The Python
SherpDaWerp wrote:
The Python wrote:I have a feature request:

Can there please be an option to the "issue" private command so that it opens any cards received when the issue is answered?

Thanks!

Issues answered by the API never generate cards (see here and here); this is a design feature rather than a bug. It's designed to prevent large-scale automatic card farming by requiring farmers to use the HTML site instead of running an API script in the background 24/7.

edit: added links

Oh, all right.

PostPosted: Mon Oct 12, 2020 8:00 pm
by Dolgo
Anyone know of a quick way of obtaining values for a particular statistic (e.g. Intelligence) throughout the course of a nation's history?

Purely for example, from: 2020/01/01–2020/10/12.

I've read the API documentation, but not sure how to get the values in a simple list to paste into Google Sheets.

PostPosted: Mon Oct 12, 2020 9:40 pm
by Dolgo
For example: I've got this XML for the Intelligence stat for my nation Dolgo:

Code: Select all
<NATION id="dolgo">
<CENSUS>
<SCALE id="36">
<POINT>
<TIMESTAMP>1588575600</TIMESTAMP>
<SCORE>1.41</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1588662000</TIMESTAMP>
<SCORE>11.47</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1588748400</TIMESTAMP>
<SCORE>10.12</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1588834800</TIMESTAMP>
<SCORE>13.38</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1588921200</TIMESTAMP>
<SCORE>12.43</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589007600</TIMESTAMP>
<SCORE>15.53</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589094000</TIMESTAMP>
<SCORE>16.45</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589180400</TIMESTAMP>
<SCORE>18.84</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589266800</TIMESTAMP>
<SCORE>18.68</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589353200</TIMESTAMP>
<SCORE>19.76</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589439600</TIMESTAMP>
<SCORE>20.41</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589526000</TIMESTAMP>
<SCORE>21.56</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589612400</TIMESTAMP>
<SCORE>21.35</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589698800</TIMESTAMP>
<SCORE>19.26</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589785200</TIMESTAMP>
<SCORE>19.95</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589871600</TIMESTAMP>
<SCORE>21.41</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1589958000</TIMESTAMP>
<SCORE>20.81</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590044400</TIMESTAMP>
<SCORE>23.29</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590130800</TIMESTAMP>
<SCORE>24.55</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590217200</TIMESTAMP>
<SCORE>24.86</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590303600</TIMESTAMP>
<SCORE>26.9</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590390000</TIMESTAMP>
<SCORE>27.91</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590476400</TIMESTAMP>
<SCORE>28.23</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590562800</TIMESTAMP>
<SCORE>28.25</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590649200</TIMESTAMP>
<SCORE>28.23</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590735600</TIMESTAMP>
<SCORE>28.64</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590822000</TIMESTAMP>
<SCORE>29.74</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590908400</TIMESTAMP>
<SCORE>29.11</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1590994800</TIMESTAMP>
<SCORE>32.35</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591081200</TIMESTAMP>
<SCORE>33.14</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591167600</TIMESTAMP>
<SCORE>35.11</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591254000</TIMESTAMP>
<SCORE>35.1</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591340400</TIMESTAMP>
<SCORE>35.41</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591426800</TIMESTAMP>
<SCORE>35.42</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591513200</TIMESTAMP>
<SCORE>35.72</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591599600</TIMESTAMP>
<SCORE>35.89</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591686000</TIMESTAMP>
<SCORE>38.06</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591772400</TIMESTAMP>
<SCORE>38.56</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591858800</TIMESTAMP>
<SCORE>38.65</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1591945200</TIMESTAMP>
<SCORE>39.14</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592031600</TIMESTAMP>
<SCORE>38.36</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592118000</TIMESTAMP>
<SCORE>38.36</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592204400</TIMESTAMP>
<SCORE>40</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592290800</TIMESTAMP>
<SCORE>39.98</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592377200</TIMESTAMP>
<SCORE>42.42</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592463600</TIMESTAMP>
<SCORE>43.11</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592550000</TIMESTAMP>
<SCORE>44.92</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592636400</TIMESTAMP>
<SCORE>44.82</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592722800</TIMESTAMP>
<SCORE>46.61</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592809200</TIMESTAMP>
<SCORE>47.08</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592895600</TIMESTAMP>
<SCORE>48.7</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1592982000</TIMESTAMP>
<SCORE>49.74</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593068400</TIMESTAMP>
<SCORE>50.02</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593154800</TIMESTAMP>
<SCORE>50.02</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593241200</TIMESTAMP>
<SCORE>52.04</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593327600</TIMESTAMP>
<SCORE>53.14</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593414000</TIMESTAMP>
<SCORE>53.54</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593500400</TIMESTAMP>
<SCORE>53.54</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593586800</TIMESTAMP>
<SCORE>53.06</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593673200</TIMESTAMP>
<SCORE>53.06</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593759600</TIMESTAMP>
<SCORE>52.16</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593846000</TIMESTAMP>
<SCORE>52.65</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1593932400</TIMESTAMP>
<SCORE>52.9</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594018800</TIMESTAMP>
<SCORE>52.77</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594105200</TIMESTAMP>
<SCORE>52.75</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594191600</TIMESTAMP>
<SCORE>52.87</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594278000</TIMESTAMP>
<SCORE>55.51</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594364400</TIMESTAMP>
<SCORE>56.83</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594450800</TIMESTAMP>
<SCORE>57.96</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594537200</TIMESTAMP>
<SCORE>57.96</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594623600</TIMESTAMP>
<SCORE>58.01</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594710000</TIMESTAMP>
<SCORE>58.08</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594796400</TIMESTAMP>
<SCORE>59.11</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594882800</TIMESTAMP>
<SCORE>59.19</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1594969200</TIMESTAMP>
<SCORE>60.36</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595055600</TIMESTAMP>
<SCORE>60.37</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595142000</TIMESTAMP>
<SCORE>60.66</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595228400</TIMESTAMP>
<SCORE>60.33</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595314800</TIMESTAMP>
<SCORE>60.87</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595401200</TIMESTAMP>
<SCORE>61.48</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595487600</TIMESTAMP>
<SCORE>62.27</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595574000</TIMESTAMP>
<SCORE>62.38</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595660400</TIMESTAMP>
<SCORE>62.87</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595746800</TIMESTAMP>
<SCORE>63.4</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595833200</TIMESTAMP>
<SCORE>63.34</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1595919600</TIMESTAMP>
<SCORE>63.74</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596006000</TIMESTAMP>
<SCORE>63.63</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596092400</TIMESTAMP>
<SCORE>61.97</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596178800</TIMESTAMP>
<SCORE>62.08</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596265200</TIMESTAMP>
<SCORE>62.16</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596351600</TIMESTAMP>
<SCORE>61.93</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596438000</TIMESTAMP>
<SCORE>62.11</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596524400</TIMESTAMP>
<SCORE>62.22</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596610800</TIMESTAMP>
<SCORE>62.01</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596697200</TIMESTAMP>
<SCORE>61.72</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596783600</TIMESTAMP>
<SCORE>61.72</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596870000</TIMESTAMP>
<SCORE>62.49</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1596956400</TIMESTAMP>
<SCORE>62.49</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597042800</TIMESTAMP>
<SCORE>62.16</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597129200</TIMESTAMP>
<SCORE>61.53</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597215600</TIMESTAMP>
<SCORE>62.88</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597302000</TIMESTAMP>
<SCORE>63.72</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597388400</TIMESTAMP>
<SCORE>63.55</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597474800</TIMESTAMP>
<SCORE>63.55</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597561200</TIMESTAMP>
<SCORE>63.14</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597647600</TIMESTAMP>
<SCORE>63.62</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597734000</TIMESTAMP>
<SCORE>66.14</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597820400</TIMESTAMP>
<SCORE>66.6</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597906800</TIMESTAMP>
<SCORE>66.92</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1597993200</TIMESTAMP>
<SCORE>66.24</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598079600</TIMESTAMP>
<SCORE>65.98</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598166000</TIMESTAMP>
<SCORE>65.99</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598252400</TIMESTAMP>
<SCORE>65.97</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598338800</TIMESTAMP>
<SCORE>66.01</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598425200</TIMESTAMP>
<SCORE>66.05</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598511600</TIMESTAMP>
<SCORE>65.75</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598598000</TIMESTAMP>
<SCORE>65.93</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598684400</TIMESTAMP>
<SCORE>66.71</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598770800</TIMESTAMP>
<SCORE>66.72</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598857200</TIMESTAMP>
<SCORE>67.02</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1598943600</TIMESTAMP>
<SCORE>68.4</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599030000</TIMESTAMP>
<SCORE>68.32</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599116400</TIMESTAMP>
<SCORE>68.97</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599202800</TIMESTAMP>
<SCORE>68.19</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599289200</TIMESTAMP>
<SCORE>68.15</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599375600</TIMESTAMP>
<SCORE>68.15</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599462000</TIMESTAMP>
<SCORE>68.1</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599548400</TIMESTAMP>
<SCORE>68.86</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599634800</TIMESTAMP>
<SCORE>69.32</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599721200</TIMESTAMP>
<SCORE>69.42</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599807600</TIMESTAMP>
<SCORE>69.41</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599894000</TIMESTAMP>
<SCORE>69.3</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1599980400</TIMESTAMP>
<SCORE>69.12</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600066800</TIMESTAMP>
<SCORE>69.22</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600153200</TIMESTAMP>
<SCORE>69.24</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600239600</TIMESTAMP>
<SCORE>69.48</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600326000</TIMESTAMP>
<SCORE>69.85</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600412400</TIMESTAMP>
<SCORE>70.05</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600498800</TIMESTAMP>
<SCORE>69.08</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600585200</TIMESTAMP>
<SCORE>69.08</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600671600</TIMESTAMP>
<SCORE>69.42</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600758000</TIMESTAMP>
<SCORE>69.89</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600844400</TIMESTAMP>
<SCORE>70.4</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1600930800</TIMESTAMP>
<SCORE>70.12</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601017200</TIMESTAMP>
<SCORE>71.12</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601103600</TIMESTAMP>
<SCORE>72.83</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601190000</TIMESTAMP>
<SCORE>72.63</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601276400</TIMESTAMP>
<SCORE>73.02</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601362800</TIMESTAMP>
<SCORE>73.18</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601449200</TIMESTAMP>
<SCORE>73.83</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601535600</TIMESTAMP>
<SCORE>73.89</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601622000</TIMESTAMP>
<SCORE>73.17</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601708400</TIMESTAMP>
<SCORE>73.89</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601794800</TIMESTAMP>
<SCORE>74.19</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601881200</TIMESTAMP>
<SCORE>75.84</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1601967600</TIMESTAMP>
<SCORE>75.89</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1602054000</TIMESTAMP>
<SCORE>77.7</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1602140400</TIMESTAMP>
<SCORE>78.31</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1602226800</TIMESTAMP>
<SCORE>78.25</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1602313200</TIMESTAMP>
<SCORE>77.84</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1602399600</TIMESTAMP>
<SCORE>78.09</SCORE>
</POINT>
<POINT>
<TIMESTAMP>1602486000</TIMESTAMP>
<SCORE>78.4</SCORE>
</POINT>
</SCALE>
</CENSUS>
</NATION>


How do I simplify it, so that only the scores appear, in a downward list for easy pasting into Google Sheets?

PostPosted: Mon Oct 12, 2020 10:37 pm
by Merni
You can use any programming language to write a simple script to parse the XML into whatever format you wish. (Such as a csv file to use as a spreadsheet).

PostPosted: Tue Oct 13, 2020 12:31 am
by Dolgo
Merni wrote:You can use any programming language to write a simple script to parse the XML into whatever format you wish. (Such as a csv file to use as a spreadsheet).


Any pointers? I am not sure how to do this.

PostPosted: Tue Oct 13, 2020 12:57 am
by SherpDaWerp
Dolgo wrote:Any pointers? I am not sure how to do this.

if ye know not how to write code, then the API is probably not the best method of doing, well, anything. Python is a good place to start, there's heaps of good XML-parsing libraries (xmltodict is probably the best) and the syntax is very forgiving.

In the interest of being slightly more helpful, I've converted the data you already provided with a quick Python script.
data
Code: Select all
1.41
11.47
10.12
13.38
12.43
15.53
16.45
18.84
18.68
19.76
20.41
21.56
21.35
19.26
19.95
21.41
20.81
23.29
24.55
24.86
26.9
27.91
28.23
28.25
28.23
28.64
29.74
29.11
32.35
33.14
35.11
35.1
35.41
35.42
35.72
35.89
38.06
38.56
38.65
39.14
38.36
38.36
40
39.98
42.42
43.11
44.92
44.82
46.61
47.08
48.7
49.74
50.02
50.02
52.04
53.14
53.54
53.54
53.06
53.06
52.16
52.65
52.9
52.77
52.75
52.87
55.51
56.83
57.96
57.96
58.01
58.08
59.11
59.19
60.36
60.37
60.66
60.33
60.87
61.48
62.27
62.38
62.87
63.4
63.34
63.74
63.63
61.97
62.08
62.16
61.93
62.11
62.22
62.01
61.72
61.72
62.49
62.49
62.16
61.53
62.88
63.72
63.55
63.55
63.14
63.62
66.14
66.6
66.92
66.24
65.98
65.99
65.97
66.01
66.05
65.75
65.93
66.71
66.72
67.02
68.4
68.32
68.97
68.19
68.15
68.15
68.1
68.86
69.32
69.42
69.41
69.3
69.12
69.22
69.24
69.48
69.85
70.05
69.08
69.08
69.42
69.89
70.4
70.12
71.12
72.83
72.63
73.02
73.18
73.83
73.89
73.17
73.89
74.19
75.84
75.89
77.7
78.31
78.25
77.84
78.09
78.4


code
Code: Select all
import xmltodict

data = """
*snip*
"""

data_dict = xmltodict.parse(data)
for point in data_dict["NATION"]["CENSUS"]["SCALE"]["POINT"]:
    print(point["SCORE"])

PostPosted: Tue Oct 13, 2020 1:30 am
by Dolgo
SherpDaWerp wrote:
Dolgo wrote:Any pointers? I am not sure how to do this.

if ye know not how to write code, then the API is probably not the best method of doing, well, anything. Python is a good place to start, there's heaps of good XML-parsing libraries (xmltodict is probably the best) and the syntax is very forgiving.

In the interest of being slightly more helpful, I've converted the data you already provided with a quick Python script.
data
Code: Select all
1.41
11.47
10.12
13.38
12.43
15.53
16.45
18.84
18.68
19.76
20.41
21.56
21.35
19.26
19.95
21.41
20.81
23.29
24.55
24.86
26.9
27.91
28.23
28.25
28.23
28.64
29.74
29.11
32.35
33.14
35.11
35.1
35.41
35.42
35.72
35.89
38.06
38.56
38.65
39.14
38.36
38.36
40
39.98
42.42
43.11
44.92
44.82
46.61
47.08
48.7
49.74
50.02
50.02
52.04
53.14
53.54
53.54
53.06
53.06
52.16
52.65
52.9
52.77
52.75
52.87
55.51
56.83
57.96
57.96
58.01
58.08
59.11
59.19
60.36
60.37
60.66
60.33
60.87
61.48
62.27
62.38
62.87
63.4
63.34
63.74
63.63
61.97
62.08
62.16
61.93
62.11
62.22
62.01
61.72
61.72
62.49
62.49
62.16
61.53
62.88
63.72
63.55
63.55
63.14
63.62
66.14
66.6
66.92
66.24
65.98
65.99
65.97
66.01
66.05
65.75
65.93
66.71
66.72
67.02
68.4
68.32
68.97
68.19
68.15
68.15
68.1
68.86
69.32
69.42
69.41
69.3
69.12
69.22
69.24
69.48
69.85
70.05
69.08
69.08
69.42
69.89
70.4
70.12
71.12
72.83
72.63
73.02
73.18
73.83
73.89
73.17
73.89
74.19
75.84
75.89
77.7
78.31
78.25
77.84
78.09
78.4


code
Code: Select all
import xmltodict

data = """
*snip*
"""

data_dict = xmltodict.parse(data)
for point in data_dict["NATION"]["CENSUS"]["SCALE"]["POINT"]:
    print(point["SCORE"])


I am somewhat familiar with Python, having done it before in high school many years ago. This is definitely what I was looking for. I much appreciate your helpful response.

Zombie shard

PostPosted: Fri Oct 23, 2020 11:41 am
by The Python
Z-day is in only 1 week! So on the zombie public nation shard, the XML returned shows both <ZACTION> and <ZACTIONINTENDED> tags. What's the difference between these?

PostPosted: Fri Oct 23, 2020 12:11 pm
by Trotterdam
The Python wrote:Z-day is in only 1 week! So on the zombie public nation shard, the XML returned shows both <ZACTION> and <ZACTIONINTENDED> tags. What's the difference between these?
Since 2017, higher-level zombie hordes are capable of "targetting command & control structures", causing nations to start exporting zombies even if they hadn't meant to. It's easy enough to change back to your intended action if you check, but it's very deadly if it happens to inactive nations.

In this case, <ZACTION> will be "export", while <ZACTIONINTENDED> will be what the nation actually chose of its own volition ("none", "exterminate", or "research").

PostPosted: Sat Oct 24, 2020 12:32 am
by The Python
Trotterdam wrote:
The Python wrote:Z-day is in only 1 week! So on the zombie public nation shard, the XML returned shows both <ZACTION> and <ZACTIONINTENDED> tags. What's the difference between these?
Since 2017, higher-level zombie hordes are capable of "targetting command & control structures", causing nations to start exporting zombies even if they hadn't meant to. It's easy enough to change back to your intended action if you check, but it's very deadly if it happens to inactive nations.

In this case, <ZACTION> will be "export", while <ZACTIONINTENDED> will be what the nation actually chose of its own volition ("none", "exterminate", or "research").

Oh, all right. That'll be annoying since I have a border security system so that we can focus on defending other regions from zombies instead of having to focus on an outbreak in the main region (Z defenders).

PostPosted: Sat Oct 24, 2020 3:47 am
by Trotterdam
The Python wrote:Oh, all right. That'll be annoying since I have a border security system so that we can focus on defending other regions from zombies instead of having to focus on an outbreak in the main region (Z defenders).
In this case, subverted command & control structures probably won't happen in your main region, but you need to watch out for them in returning nations coming back from a field mission for recovery.

A hit with a few cure missiles will fix things, if you can't log into the actual nation affected.

PostPosted: Sat Oct 24, 2020 12:07 pm
by The Python
Trotterdam wrote:
The Python wrote:Oh, all right. That'll be annoying since I have a border security system so that we can focus on defending other regions from zombies instead of having to focus on an outbreak in the main region (Z defenders).
In this case, subverted command & control structures probably won't happen in your main region, but you need to watch out for them in returning nations coming back from a field mission for recovery.

A hit with a few cure missiles will fix things, if you can't log into the actual nation affected.

One has to go to the quarantine after leaving the main region, but if we happen to get zombies is the main region, then that could aggravate the outbreak so I've added a rule that you must leave the main region if you are going inactive.

PostPosted: Sun Oct 25, 2020 10:34 am
by The Northern Light
Request

Would it be possible to add collection value as a field in the information returned by the cards COLLECTION shard?

https://www.nationstates.net/cgi-bin/ap ... ectionid=1

Thanks in advance!

PostPosted: Sat Nov 07, 2020 11:10 am
by Aeioux
Are World->Happenings->Event entries (?q=happenings) older than one week from now() available anywhere? It appears i am too late to gather statistics on the Z-Day for my region as all queries for events older than 1604162753 timestamp (98534512 event id) returned an empty list. I wonder if that data exists anywhere officially (some "hidden" daily dumps?) or, perhaps, saved by someone else.

PostPosted: Sat Nov 14, 2020 6:52 pm
by The Northern Light
Request

Would it be possible to provide a shard that allows getting a nation's completed card buys and sales? Following the format of the ASKSBIDS shard, this could be, e.g.,

https://www.nationstates.net/cgi-bin/ap ... testlandia

https://www.nationstates.net/cgi-bin/ap ... testlandia

Having this would be incredibly helpful for, e.g., analyzing the total cost to put together specific collections, or the activity of individual nations.

Thanks in advance!

PostPosted: Mon Nov 16, 2020 10:29 am
by Leutria
Is it possible to simply check if you are already logged into a nation without having to input the password/pin?

PostPosted: Mon Nov 16, 2020 10:35 am
by Frisbeeteria
Leutria wrote:Is it possible to simply check if you are already logged into a nation without having to input the password/pin?

Sure. Go to https://www.nationstates.net/. If you see your nation with the telegrams and notices at the top, you're logged in. If you just see the NS logo, you're not.

PostPosted: Mon Nov 16, 2020 10:44 am
by Leutria
Frisbeeteria wrote:
Leutria wrote:Is it possible to simply check if you are already logged into a nation without having to input the password/pin?

Sure. Go to https://www.nationstates.net/. If you see your nation with the telegrams and notices at the top, you're logged in. If you just see the NS logo, you're not.
Not quite what I was hoping for, so I will take that as a no. Thanks :P

PostPosted: Mon Nov 16, 2020 10:57 am
by Frisbeeteria
Leutria wrote:I will take that as a no.

Sorry, I read this as the FAQ thread. I don't know what the API answer would be.

PostPosted: Mon Nov 16, 2020 12:53 pm
by Trotterdam
You mean, like, checking whether the nation is already logged into on any device, even one that is different from the one running the API script, without interrupting that session by replacing it with the API's own login?

I'm pretty sure we don't have something like that. For that matter, even if you log in anew, I don't think there's any way to tell if it interrupted a previous session or not.

PostPosted: Mon Nov 16, 2020 3:48 pm
by The Python
Leutria wrote:Is it possible to simply check if you are already logged into a nation without having to input the password/pin?

If you mean API private commands/shards, from my knowledge it automatically logs you our as soon as the private command/shard has been completed.

PostPosted: Mon Nov 16, 2020 7:04 pm
by Trotterdam
The Python wrote:If you mean API private commands/shards, from my knowledge it automatically logs you our as soon as the private command/shard has been completed.
I don't think it does. Like manual logins, the session stays valid until it times out or is replaced by another session. Otherwise the X-Pin in the flowchart would serve no purpose.

PostPosted: Mon Nov 16, 2020 11:18 pm
by The Python
Trotterdam wrote:
The Python wrote:If you mean API private commands/shards, from my knowledge it automatically logs you our as soon as the private command/shard has been completed.
I don't think it does. Like manual logins, the session stays valid until it times out or is replaced by another session. Otherwise the X-Pin in the [url=http://www.nationstates.net/pages/api.html#nationapi-privatecommands[/url]flowchart[/url] would serve no purpose.

Yes but you have to re-authenticate each time you do a command.

PostPosted: Wed Nov 18, 2020 4:19 pm
by [violet]
Leutria wrote:Is it possible to simply check if you are already logged into a nation without having to input the password/pin?

It's not possible to check other people's session status. If you want to check your own session status, you have to prove who you are. So no, basically. You can't check whether a session is valid without telling the server which session you mean.

The Python wrote:
Trotterdam wrote:I don't think it does. Like manual logins, the session stays valid until it times out or is replaced by another session. Otherwise the X-Pin in the [url=http://www.nationstates.net/pages/api.html#nationapi-privatecommands[/url]flowchart[/url] would serve no purpose.

Yes but you have to re-authenticate each time you do a command.

If you provide a valid pin, you don't need any other authentication. The pin is proof you've already authenticated.

PostPosted: Fri Nov 20, 2020 8:52 am
by August
Bug report: census scores retrieved with the history mode enabled are multiplied by 100 after Sep 8.

Conch Kingdom nation count, single-value (not history) - correct
Conch Kingdom nation count, history mode - correct until Sep 8
Conch Kingdom nation count graph on the HTML site - all correct
Conch Kingdom influence census graph on the HTML site - all correct
Conch Kingdom influence census graph generated from API data - fubared

I used CK as an example, but this seems to apply to all regions. Even though the incorrect values date back to two months ago, this problem just started today. My application makes history queries all the time with no issues.