Page 92 of 97

PostPosted: Tue Sep 13, 2022 10:11 pm
by [violet]
Ferranghia wrote:Hithere's a value that's being printed in the census XML in scientific notation

Which region is this? Will be easier to fix if I can test.

PostPosted: Wed Sep 14, 2022 12:48 am
by Trotterdam
[violet] wrote:
Ferranghia wrote:Hithere's a value that's being printed in the census XML in scientific notation
Which region is this? Will be easier to fix if I can test.
I don't know exactly which nation Ferranghia was looking at, but I can easily enough find other examples by just looking at the top nations for the relevant score.

Try this one.

PostPosted: Wed Sep 14, 2022 5:20 am
by Ferranghia
[violet] wrote:
Ferranghia wrote:Hithere's a value that's being printed in the census XML in scientific notation

Which region is this? Will be easier to fix if I can test.

Right, sorry.

I was looking at my own nation, Ferranghia. Here's the link for my country's census.

The specific URL I was calling was the one with the complete census, but that shouldn't be the issue.

PostPosted: Sat Oct 08, 2022 10:13 am
by Estingberg
Hi. This may be the wrong thread, but If I may ask a question about the NS API.

I'm making a python script that will automatically login to my puppet.
import requests
header={
'X-Password':'****************'
}
Data={'UserAgent':'*********************'}
url="https://www.nationstates.net/cgi-bin/api.cgi?nation=realm_defense_group_northwest&q=notices"
reply=requests.post(url,data=Data,headers=header)
print(reply)


I keep getting 403 errors and I don't know why. I believe my trouble is that I'm incorrectly formatting header and body data, I'm fairly to new web-scripting so I'm not sure.

PostPosted: Sat Oct 08, 2022 11:35 am
by United Calanworie
Estingberg wrote:Hi. This may be the wrong thread, but If I may ask a question about the NS API.

I'm making a python script that will automatically login to my puppet.
import requests
header={
'X-Password':'****************'
}
Data={'UserAgent':'*********************'}
url="https://www.nationstates.net/cgi-bin/api.cgi?nation=realm_defense_group_northwest&q=notices"
reply=requests.post(url,data=Data,headers=header)
print(reply)


I keep getting 403 errors and I don't know why. I believe my trouble is that I'm incorrectly formatting header and body data, I'm fairly to new web-scripting so I'm not sure.

Try making a GET request instead of POST, our documentation doesn't specify which route it accepts but I would think it's probably GET.

PostPosted: Sat Oct 08, 2022 2:46 pm
by Eluvatar
Also, the user agent should be a header, not POST fields.

PostPosted: Sat Oct 08, 2022 9:37 pm
by Trotterdam
United Calanworie wrote:Try making a GET request instead of POST, our documentation doesn't specify which route it accepts but I would think it's probably GET.
GET and POST work equally well.

For things that actually make a change server-side, like logging in, the official HTTP standard strongly recommends using POST, even if GET technically works. Personally I use POST even for read-only requests that don't make any change, just because it's very slightly more convenient for me to code.

But yes, as Eluvatar says, the user agent should be a header, not a GET/POST field.

PostPosted: Sat Oct 15, 2022 11:01 am
by Estingberg
I'm using the NaStyAPI python module to make a script. It appears that I accidently broke the rate limit.

Exception has occurred: APIRateLimitBan
Nationstates API has temporary banned this IP for Breaking the Rate Limit. Retry-After: 277
File "C:\Users\*******\OneDrive\Desktop\PythonPrograms\nsmainter", line 56, in <module>
issues=CurrentNation.get_shards("issues")


firstly, If I'm IP banned, why was I able to immediately log to my main nation right thereafter? Secondly, could my personal accounts be subject deletion if this accident were to happen again?

PostPosted: Sat Oct 15, 2022 11:28 am
by United Calanworie
Estingberg wrote:I'm using the NaStyAPI python module to make a script. It appears that I accidently broke the rate limit.

Exception has occurred: APIRateLimitBan
Nationstates API has temporary banned this IP for Breaking the Rate Limit. Retry-After: 277
File "C:\Users\*******\OneDrive\Desktop\PythonPrograms\nsmainter", line 56, in <module>
issues=CurrentNation.get_shards("issues")


firstly, If I'm IP banned, why was I able to immediately log to my main nation right thereafter?

It's only an API ban, not a site ban.
Secondly, could my personal accounts be subject deletion if this accident were to happen again?

Generally no, you do not receive moderation action for API scripts -- that's why the API self-enforces its ratelimit with a temporary IP ban. Some exceptions may apply, but those are for deliberately designed broken scripts that damage the site.

PostPosted: Sat Oct 15, 2022 12:39 pm
by Estingberg
Another Question; why on earth is
head={"UserAgent":"****************"}
info=requests.post("http://www.nationstates.net/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0;mode=score",
headers=head)


Producing this garbage data:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aaf443e97618c8')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=qaAZGw5U1FKvv01ZSTG7u2gShHGhfRzIBdR8raC76tM-1665862067-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="YcNPoOpZ5bwJT5Gf5UGAjFqoM_s7U9myXGVj0q92Qn4-1665862067-0-AXHYiRE0f8AGobpgxAs1ZH9RiNJVx66HS-cTzVL5BsX_qQlZRxMSCeN1gG14QBt_E7-Cjl4TZtCa2BWf-cpg4by98gP1gg0IGYxXk-6Ipq2He8_OsfpwDUGyKliPvAzBJGi1VLHpoIZes95ufAGx4Ar0i0DbUd2T2sdqXjepn7C40B8ZoxZYme_uAg0wHlMxXdqJujWKcx3stEX0wMNBWDcb0UCnNTylqxz0VEmw1qcFJKYxR-mym3AcKJoof8sNNEqlrSNNmEG1Io4tt_aU8sJWD0fWBcl6KebEzk7ItG0UJe8QOE1XlZLnuwPaq6GnRA-LQw6PrWWUYm
PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60447' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aaf8cf9d9817f5')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="UiWDVMj6mT3Yj7r4Px4eZKzf8EchZIPaE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pgzFGDgiE9cSqqV8W0hRedMCL1BtklzmRtCrzg3dd9t1y1mRkzyG8FusSW7WVFbKvVDDV8dUMB339F2PS6jH3IQw7t6n+XvsVI4lzbJbEsM5ZcPTJuScesbOwmYjVIQuNi3o1XyIZVchWkA5rIhbCB56yPg2W5Q7pGBq8nbOtqXggV67zBVdH2FdLylZRuqjtkCLiC7xkDuzO1dujLr+pNMqCYgAYEGBzwbdEJQxsZhf3oLWQ9F666zVidlB8G9xTl+ZrO8tw452oriuEJEiHIj4CzRoplHqPeJAFO8XvtPdwco0Blp56OWddR8xYc5N4iouA6a4f1PBDUTa4aR6aH9KvZeCrs0fow6gawXzeYsb49jpp3batIXXuc29xlXA5yT/3WLL7SBFPuw283ZheFjTgvPhjCa5ovj5KBd92eWqFMoulk2xVZA72WDlOIgvh/P0tvQI+jA28tzjjp1XRYq7GvpMe34BiP+khuZ+OHpZ9xAJUsJe5w=="/>
</form>
</div>
</div>
<script>
(function(){
window._cf_chl_opt={
cvId: '2',
cType: 'managed',
cNounce: '5018',
cRay: '75aaf8cf9d9817f5',
cHash: '218306b50365a43',
cUPMDTk: "\/cgi-bin\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0",
cFPWv: 'g',
cTTimeMs: '1000',
cTplV: 4,
cTplB: 'cf',
cRq: {
ru: 'aHR0cDovL3d3dy5uYXRpb25zdGF0ZXMubmV0L2NnaS1iaW4vYXBpLmNnaT9uYXRpb249ZXN0aW5nYmVyZztxPWNlbnN1cztzY2FsZT0wJTIwJTIwJTIwJTIwJTIwO21vZGU9c2NvcmU=',
ra: 'cHl0aG9uLXJlcXVlc3RzLzIuMjUuMQ==',
rm: 'UE9TVA==',
d: 'iMaadKnRq8lcj1O/BHc7M5IKDw0P4ZwJ4L5XTEi1de7AMlzPy/1avEaxAJJUhUQxhM+Tza+AfgIo+ylXM1K1ncekLbcXRtplzOdV/YoW9NxnvVoU/f95z/lRaK5b1V8/VeW1bJF/92qT7KRCdMHs32QM2BXxymKiykDYhj8eHKd9fArEfYtJqerFySKvo9Lfbx7ZoneHz2Iblj1Kh/KqUD58a2jLXemOsWzp8klLguxfiINweoV5s5wv5iA+OoOc9fUuj5X4FqIDXITKe9mM7Fu8+vtO7n2KgpwssPoABTTjna+soEWstFa2gRUji9o+hIZynJOfSSqdph/GVMSJgZxqpC8+qdmjoWzGK5LCS2qvohDFcJdCh7oJPnLMnsuBp9GBLbI1sauLFVDfyyWPQVR6ImK26fPQJQ/7k8ZuBTKr7eQwj6SPa9ZEV2ZSNNdYc8k7de7GgtU/KsHVAQZvdmindYRx1cbvlVc3qSscrNx2Oa0VvvK2WX0Ae4Kx7K/wmYEspU3sMu66HvJ2x12+xJmsXr3lrxg/N8t29lz4M4R8UGLqMIhZlwzPdZn4+kejNrYRP6QP2UAVUfvXoVQmm9Htn+DHUbwPBu84Ys+RkJW2tvaaI2k1TLcX2JODzP+hiNr9OEUuSnqqSV6jkrKR4w==',
t: 'MTY2NTg2MjI1NC4wMjMwMDA=',
m: '1F3IAe1M7tDWHjgMHedrrbuvezBj75qqN4VZoyN+7Bs=',
i1: 'PXBwz5/U23SdZ6HZV4tBoQ==',
i2: '5qcHUAS1hEL9hxTWZSTuzQ==',
zh: 'B3j7jvkb6SpbC7cpPha9Fxw1RQntpO1XX0YD0OxCNf0=',
uh: '5GU+jYv2xJ+bCaE/ARmi/DORbiS/v56CW7E0TH4XWQk=',
hh: 'j/qeecdtcvB7nDzYaem6Np88JS3WCwPWX/VL84dFkD0=',
}
};
var trkjs = document.createElement('img');
trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=75aaf8cf9d9817f5');
trkjs.setAttribute('style', 'display: none');
document.body.appendChild(trkjs);
var cpo = document.createElement('script');
cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/managed/v1?ray=75aaf8cf9d9817f5';
window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;
if (window.history && window.history.replaceState) {
var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
history.replaceState(null, null, "\/cgi-bin\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_rt_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0" + window._cf_chl_opt.cOgUHash);
cpo.onload = function() {
history.replaceState(null, null, ogU);
};
}
document.getElementsByTagName('head')[0].appendChild(cpo);
}());
</script>

<div class="footer" role="contentinfo">
<div class="footer-inner">
<div class="clearfix diagnostic-wrapper">
<div class="ray-id">Ray ID: <code>75aaf8cf9d9817f5</code></div>
</div>
<div class="text-center">Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
</div>
</div>
</body>
</html>

PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60507' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
Traceback (most recent call last):
File "c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py", line 4, in <module>
info=requests.post("http://www.nationstates.net/api.cgi?nation=estingberg;q=census;scale=0 \
File "C:\Users\aidan\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Users\aidan\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
TypeError: Session.request() got an unexpected keyword argument 'headerS'
PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60519' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aafb50ba58c409')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="l4tpARlZ.ge.lfq6TFOtW_oOfgPKMFCNwi0hP.1GSaM-1665862356-0-ASz27JC8pfmaWX0enimh7zTIBTCyq3-t2mbNHpYa-dhnuh1p7YtbpZrkeJfyFH9i9YQMbGMNafeGHHQUT-7dTJyblXTfAvWPwUx850Dnn2TklL-3AdLaGQIe186UZToEukbJo1mSDuMpKvsQuMSNOZUDMpyUcQ7XjbJNhl91iRnWjZwg8OQ-zuQzsfXBfe1t9ovIxQNFGVNeh9CF5Q4IAHMSYuDQmitZN9QtaGOSvY5TnsLBJKeFcCVhAlr7aeGcjT5SQFWF_xBCEF8ag_dUeYPENfCyAAf1KjyGBWoVhUR1QVFjXBIwlCNZM-sf0w6ETkY5DOPk9DmLbS0kZ1-rsZE6CNNbkoxweZM5Ki2jPvAm5Zbc9p0KNdi56y-MUkRskspB3hHjr1miX6RXiOYdUPaW_0tafuqT3qBe_m3MjOF_5rLHpJWG7v0CGMIMFFwvAsKXz9RKLbisDpvQtCpmx-kBPT6H9ABHYI7Ut6qfZ1ZdfzHiqyhVfWrBlMK9lggyk-lQPTQsv9gEEmid9v-4IA576Z97mrIhk2ZugGLQd6A9rkeKiq3FZZ6UZVJYzd-MQtAT1tHIKQGMH6aw4DT8HU2ecsO89I47SjHSotjvVI1kSqGWrBqB22L50POGxQrFJlhTxInXvRFViUXjQDAiGgSi8yCym_vBP1vbQLVC3WLx5VL5bjDPUJMxxKHFIx_ILfERnjCIBev6ZoHg49p7KSYpDtt8zs4igAjZicNw-eUPyfcY3j-savm1ZSlN6TbC1VmUymeI6ndYuxhWcMdiSAOXKXBlyYY9m1T4qXkDrBHw0PUnUIG2-LCyJrDtBjTcSQ" />
<input type="hidden" name="r" value="ktosa7.2tZZN38WaCCeOjG8VTcVbZhKxlLa5vpN5ukc-1665862356-0-AanjVFrEtWl6OLno/I5JpGfilqKcLsQIFtVX3U8uqaRIPxCEHg1zG1a0rKejEeJwGs0FejtmhOMKiTvzmbpinoKyUaJzydfvnlO3MUuPWnjI0JKbQQiqhlQNw5ZpvzP0EPTBge9CQuUEWnFY0UeZCfcNIR/PesXvgQTiioUQXuwItIEpfTDMZlCX1EGkZGf3nnX9a3w2XgLdjoMEgy23lPRgToc4/r2zC+xdG6WuuEwjPZ4w524JxjV8gnF38jR4w4HdLY7xSbMlrkBOfN16qBtVAyTWKn0rouCHp3iHwbZN6FLjLyNL1UOSjv+id2Qq0w5jQDx4azlvmQ/X8Y9maLSiAWHopDIcj0v1GEABfvceHUfux9rKTb3dikTi+FQYYQEH5sSKqYXWcDw3ddZpM2ET+wljDXDZ5cBcfCbrzQC+IRK4AbnOh7D/BoqST4kHylOYIlW1TyMzopsaPaa4u4mlwpuSwxQ2kvykkPFe0MVtUkIyEYCi0xXovJJ36OqHSXBLKmUw/4IA+wGRg1KV9yD2QaV+GZKNWJ3M3WYpdy+9XCzcdJyLoAvMv8KGipAKV8nr/cqozMVO87jl+5vCNMRpnOjZ/YUhDHhUJi9TYeYqUB9+80F45bZmZNj7uNal1g=="/>
</form>
</div>
</div>
<script>
(function(){
window._cf_chl_opt={
cvId: '2',
cType: 'managed',
cNounce: '67',
cRay: '75aafb50ba58c409',
cHash: '482a02faa6b5131',
cUPMDTk: "\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0",
cFPWv: 'g',
cTTimeMs: '1000',
cTplV: 4,
cTplB: 'cf',
cRq: {
ru: 'aHR0cDovL3d3dy5uYXRpb25zdGF0ZXMubmV0L2FwaS5jZ2k/bmF0aW9uPWVzdGluZ2Jlcmc7cT1jZW5zdXM7c2NhbGU9MCUyMCUyMCUyMCUyMCUyMDttb2RlPXNjb3Jl',
ra: 'cHl0aG9uLXJlcXVlc3RzLzIuMjUuMQ==',
rm: 'UE9TVA==',
d: 'UfXoQ98vEy31OGqMpbqWYDE4AHvIM8AIdEbgQ2Lfttn6bAmvpiVoWYOPe5FAulHdcO5C4fILUbvg7ln9ybo7OWKPYYug29IAKWJxVbvPSjqlinLDTVSSEsmNIJfnJtlCp6mb8d61cUtsjcwsCd/SGyKWua0pMFmKF78hvpl+JvTjPiS+qbnr/xyvi+a21ULXhzbd5GMpZYkCO5IknG6MIKoitk/2CUg31InfuUj8v5dYyQRxppTXD3SlrrQSF1/ouIaupBWwH6SLekeviB/ngRq/EXgosMZg61+vpvq7mfJxNYLmXTp3J4Mu2SIHZHskmmA7OPBUb6DLF20jDJaTogEIFDr+c2cLO32tSPdDGFJWgqROAvVThz67SP1ZjWE3yPuyT65PmW5jk/f6Gdf7uW0o0vPGpE7IfykljmZS3L8lBHy0h9nbXqlesoEp1Aa4NEBajgp4dcdJkS0iRAQ4OaaZWtUAvmRiBlWjQyl2mTrihvtc3u99dBeFtrd5LVDyukDLv8W9BqTFR3JRGaWVkMgU83mxOxVRcBCzScvwhImv9D0+NwpqtThfGXY1j1DIODHXqsAyygRRzTGsRNb5sXPdSKedTyEKtWsW7peD8INKsB0pG+9P6jTfRuwJMfMNzOBH/cNgIKhObLloOBEpxQ==',
t: 'MTY2NTg2MjM1Ni42MTEwMDA=',
m: 'BbDJs0idPFp/PVcLwnYsHHuUpoMnAq0HQOxND0BEwf4=',
i1: 'q+lrbfJp+zVCjo/ZOBh9rw==',
i2: 'Tj7KBksfnWyDHhEZB8rRxg==',
zh: 'B3j7jvkb6SpbC7cpPha9Fxw1RQntpO1XX0YD0OxCNf0=',
uh: '5GU+jYv2xJ+bCaE/ARmi/DORbiS/v56CW7E0TH4XWQk=',
hh: 'j/qeecdtcvB7nDzYaem6Np88JS3WCwPWX/VL84dFkD0=',
}
};
var trkjs = document.createElement('img');
trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=75aafb50ba58c409');
trkjs.setAttribute('style', 'display: none');
document.body.appendChild(trkjs);
var cpo = document.createElement('script');
cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/managed/v1?ray=75aafb50ba58c409';
window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;
if (window.history && window.history.replaceState) {
var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
history.replaceState(null, null, "\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_rt_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0" + window._cf_chl_opt.cOgUHash);
cpo.onload = function() {
history.replaceState(null, null, ogU);
};
}
document.getElementsByTagName('head')[0].appendChild(cpo);
}());
</script>

<div class="footer" role="contentinfo">
<div class="footer-inner">
<div class="clearfix diagnostic-wrapper">
<div class="ray-id">Ray ID: <code>75aafb50ba58c409</code></div>
</div>
<div class="text-center">Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
</div>
</div>
</body>
</html>

A summary of the data is that it's an html page from Cloudflare saying "Checking if the site connection is secure" that lacks the data I'm looking for.

PostPosted: Sat Oct 15, 2022 2:02 pm
by United Calanworie
Estingberg wrote:Another Question; why on earth is
head={"UserAgent":"****************"}
info=requests.post("http://www.nationstates.net/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0;mode=score",
headers=head)


Producing this garbage data:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aaf443e97618c8')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=qaAZGw5U1FKvv01ZSTG7u2gShHGhfRzIBdR8raC76tM-1665862067-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="YcNPoOpZ5bwJT5Gf5UGAjFqoM_s7U9myXGVj0q92Qn4-1665862067-0-AXHYiRE0f8AGobpgxAs1ZH9RiNJVx66HS-cTzVL5BsX_qQlZRxMSCeN1gG14QBt_E7-Cjl4TZtCa2BWf-cpg4by98gP1gg0IGYxXk-6Ipq2He8_OsfpwDUGyKliPvAzBJGi1VLHpoIZes95ufAGx4Ar0i0DbUd2T2sdqXjepn7C40B8ZoxZYme_uAg0wHlMxXdqJujWKcx3stEX0wMNBWDcb0UCnNTylqxz0VEmw1qcFJKYxR-mym3AcKJoof8sNNEqlrSNNmEG1Io4tt_aU8sJWD0fWBcl6KebEzk7ItG0UJe8QOE1XlZLnuwPaq6GnRA-LQw6PrWWUYm
PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60447' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aaf8cf9d9817f5')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="UiWDVMj6mT3Yj7r4Px4eZKzf8EchZIPaE9tlO0ciknA-1665862254-0-AcwijUv0gsXTq_H5qbPEyCklKdHk0Z9C8BRJGAHn7a3ZLA882oIxGbQvowyXgbDULREVi_KZ1d9nhJGwIUQSza8TEpCsmTJWGnXVQXPoqh00TQ5FgfIEmrn9_byS86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5rIhbCB56yPg2W5Q7pGBq8nbOtqXggV67zBVdH2FdLylZRuqjtkCLiC7xkDuzO1dujLr+pNMqCYgAYEGBzwbdEJQxsZhf3oLWQ9F666zVidlB8G9xTl+ZrO8tw452oriuEJEiHIj4CzRoplHqPeJAFO8XvtPdwco0Blp56OWddR8xYc5N4iouA6a4f1PBDUTa4aR6aH9KvZeCrs0fow6gawXzeYsb49jpp3batIXXuc29xlXA5yT/3WLL7SBFPuw283ZheFjTgvPhjCa5ovj5KBd92eWqFMoulk2xVZA72WDlOIgvh/P0tvQI+jA28tzjjp1XRYq7GvpMe34BiP+khuZ+OHpZ9xAJUsJe5w=="/>
</form>
</div>
</div>
<script>
(function(){
window._cf_chl_opt={
cvId: '2',
cType: 'managed',
cNounce: '5018',
cRay: '75aaf8cf9d9817f5',
cHash: '218306b50365a43',
cUPMDTk: "\/cgi-bin\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0",
cFPWv: 'g',
cTTimeMs: '1000',
cTplV: 4,
cTplB: 'cf',
cRq: {
ru: 'aHR0cDovL3d3dy5uYXRpb25zdGF0ZXMubmV0L2NnaS1iaW4vYXBpLmNnaT9uYXRpb249ZXN0aW5nYmVyZztxPWNlbnN1cztzY2FsZT0wJTIwJTIwJTIwJTIwJTIwO21vZGU9c2NvcmU=',
ra: 'cHl0aG9uLXJlcXVlc3RzLzIuMjUuMQ==',
rm: 'UE9TVA==',
d: 'iMaadKnRq8lcj1O/BHc7M5IKDw0P4ZwJ4L5XTEi1de7AMlzPy/1avEaxAJJUhUQxhM+Tza+AfgIo+ylXM1K1ncekLbcXRtplzOdV/YoW9NxnvVoU/f95z/lRaK5b1V8/VeW1bJF/92qT7KRCdMHs32QM2BXxymKiykDYhj8eHKd9fArEfYtJqerFySKvo9Lfbx7ZoneHz2Iblj1Kh/KqUD58a2jLXemOsWzp8klLguxfiINweoV5s5wv5iA+OoOc9fUuj5X4FqIDXITKe9mM7Fu8+vtO7n2KgpwssPoABTTjna+soEWstFa2gRUji9o+hIZynJOfSSqdph/GVMSJgZxqpC8+qdmjoWzGK5LCS2qvohDFcJdCh7oJPnLMnsuBp9GBLbI1sauLFVDfyyWPQVR6ImK26fPQJQ/7k8ZuBTKr7eQwj6SPa9ZEV2ZSNNdYc8k7de7GgtU/KsHVAQZvdmindYRx1cbvlVc3qSscrNx2Oa0VvvK2WX0Ae4Kx7K/wmYEspU3sMu66HvJ2x12+xJmsXr3lrxg/N8t29lz4M4R8UGLqMIhZlwzPdZn4+kejNrYRP6QP2UAVUfvXoVQmm9Htn+DHUbwPBu84Ys+RkJW2tvaaI2k1TLcX2JODzP+hiNr9OEUuSnqqSV6jkrKR4w==',
t: 'MTY2NTg2MjI1NC4wMjMwMDA=',
m: '1F3IAe1M7tDWHjgMHedrrbuvezBj75qqN4VZoyN+7Bs=',
i1: 'PXBwz5/U23SdZ6HZV4tBoQ==',
i2: '5qcHUAS1hEL9hxTWZSTuzQ==',
zh: 'B3j7jvkb6SpbC7cpPha9Fxw1RQntpO1XX0YD0OxCNf0=',
uh: '5GU+jYv2xJ+bCaE/ARmi/DORbiS/v56CW7E0TH4XWQk=',
hh: 'j/qeecdtcvB7nDzYaem6Np88JS3WCwPWX/VL84dFkD0=',
}
};
var trkjs = document.createElement('img');
trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=75aaf8cf9d9817f5');
trkjs.setAttribute('style', 'display: none');
document.body.appendChild(trkjs);
var cpo = document.createElement('script');
cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/managed/v1?ray=75aaf8cf9d9817f5';
window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;
if (window.history && window.history.replaceState) {
var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
history.replaceState(null, null, "\/cgi-bin\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_rt_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0" + window._cf_chl_opt.cOgUHash);
cpo.onload = function() {
history.replaceState(null, null, ogU);
};
}
document.getElementsByTagName('head')[0].appendChild(cpo);
}());
</script>

<div class="footer" role="contentinfo">
<div class="footer-inner">
<div class="clearfix diagnostic-wrapper">
<div class="ray-id">Ray ID: <code>75aaf8cf9d9817f5</code></div>
</div>
<div class="text-center">Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
</div>
</div>
</body>
</html>

PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60507' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
Traceback (most recent call last):
File "c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py", line 4, in <module>
info=requests.post("http://www.nationstates.net/api.cgi?nation=estingberg;q=census;scale=0 \
File "C:\Users\aidan\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Users\aidan\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
TypeError: Session.request() got an unexpected keyword argument 'headerS'
PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60519' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aafb50ba58c409')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="l4tpARlZ.ge.lfq6TFOtW_oOfgPKMFCNwi0hP.1GSaM-1665862356-0-ASz27JC8pfmaWX0enimh7zTIBTCyq3-t2mbNHpYa-dhnuh1p7YtbpZrkeJfyFH9i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xdG6WuuEwjPZ4w524JxjV8gnF38jR4w4HdLY7xSbMlrkBOfN16qBtVAyTWKn0rouCHp3iHwbZN6FLjLyNL1UOSjv+id2Qq0w5jQDx4azlvmQ/X8Y9maLSiAWHopDIcj0v1GEABfvceHUfux9rKTb3dikTi+FQYYQEH5sSKqYXWcDw3ddZpM2ET+wljDXDZ5cBcfCbrzQC+IRK4AbnOh7D/BoqST4kHylOYIlW1TyMzopsaPaa4u4mlwpuSwxQ2kvykkPFe0MVtUkIyEYCi0xXovJJ36OqHSXBLKmUw/4IA+wGRg1KV9yD2QaV+GZKNWJ3M3WYpdy+9XCzcdJyLoAvMv8KGipAKV8nr/cqozMVO87jl+5vCNMRpnOjZ/YUhDHhUJi9TYeYqUB9+80F45bZmZNj7uNal1g=="/>
</form>
</div>
</div>
<script>
(function(){
window._cf_chl_opt={
cvId: '2',
cType: 'managed',
cNounce: '67',
cRay: '75aafb50ba58c409',
cHash: '482a02faa6b5131',
cUPMDTk: "\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0",
cFPWv: 'g',
cTTimeMs: '1000',
cTplV: 4,
cTplB: 'cf',
cRq: {
ru: 'aHR0cDovL3d3dy5uYXRpb25zdGF0ZXMubmV0L2FwaS5jZ2k/bmF0aW9uPWVzdGluZ2Jlcmc7cT1jZW5zdXM7c2NhbGU9MCUyMCUyMCUyMCUyMCUyMDttb2RlPXNjb3Jl',
ra: 'cHl0aG9uLXJlcXVlc3RzLzIuMjUuMQ==',
rm: 'UE9TVA==',
d: 'UfXoQ98vEy31OGqMpbqWYDE4AHvIM8AIdEbgQ2Lfttn6bAmvpiVoWYOPe5FAulHdcO5C4fILUbvg7ln9ybo7OWKPYYug29IAKWJxVbvPSjqlinLDTVSSEsmNIJfnJtlCp6mb8d61cUtsjcwsCd/SGyKWua0pMFmKF78hvpl+JvTjPiS+qbnr/xyvi+a21ULXhzbd5GMpZYkCO5IknG6MIKoitk/2CUg31InfuUj8v5dYyQRxppTXD3SlrrQSF1/ouIaupBWwH6SLekeviB/ngRq/EXgosMZg61+vpvq7mfJxNYLmXTp3J4Mu2SIHZHskmmA7OPBUb6DLF20jDJaTogEIFDr+c2cLO32tSPdDGFJWgqROAvVThz67SP1ZjWE3yPuyT65PmW5jk/f6Gdf7uW0o0vPGpE7IfykljmZS3L8lBHy0h9nbXqlesoEp1Aa4NEBajgp4dcdJkS0iRAQ4OaaZWtUAvmRiBlWjQyl2mTrihvtc3u99dBeFtrd5LVDyukDLv8W9BqTFR3JRGaWVkMgU83mxOxVRcBCzScvwhImv9D0+NwpqtThfGXY1j1DIODHXqsAyygRRzTGsRNb5sXPdSKedTyEKtWsW7peD8INKsB0pG+9P6jTfRuwJMfMNzOBH/cNgIKhObLloOBEpxQ==',
t: 'MTY2NTg2MjM1Ni42MTEwMDA=',
m: 'BbDJs0idPFp/PVcLwnYsHHuUpoMnAq0HQOxND0BEwf4=',
i1: 'q+lrbfJp+zVCjo/ZOBh9rw==',
i2: 'Tj7KBksfnWyDHhEZB8rRxg==',
zh: 'B3j7jvkb6SpbC7cpPha9Fxw1RQntpO1XX0YD0OxCNf0=',
uh: '5GU+jYv2xJ+bCaE/ARmi/DORbiS/v56CW7E0TH4XWQk=',
hh: 'j/qeecdtcvB7nDzYaem6Np88JS3WCwPWX/VL84dFkD0=',
}
};
var trkjs = document.createElement('img');
trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=75aafb50ba58c409');
trkjs.setAttribute('style', 'display: none');
document.body.appendChild(trkjs);
var cpo = document.createElement('script');
cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/managed/v1?ray=75aafb50ba58c409';
window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;
if (window.history && window.history.replaceState) {
var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
history.replaceState(null, null, "\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_rt_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0" + window._cf_chl_opt.cOgUHash);
cpo.onload = function() {
history.replaceState(null, null, ogU);
};
}
document.getElementsByTagName('head')[0].appendChild(cpo);
}());
</script>

<div class="footer" role="contentinfo">
<div class="footer-inner">
<div class="clearfix diagnostic-wrapper">
<div class="ray-id">Ray ID: <code>75aafb50ba58c409</code></div>
</div>
<div class="text-center">Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
</div>
</div>
</body>
</html>

A summary of the data is that it's an html page from Cloudflare saying "Checking if the site connection is secure" that lacks the data I'm looking for.

I honestly have no answer for you on that one -- it happened to me the other day when I accidentally dropped the headers from one of the requests I made to fetch a daily dump.

PostPosted: Sat Oct 15, 2022 2:08 pm
by Sandaoguo
Estingberg wrote:A summary of the data is that it's an html page from Cloudflare saying "Checking if the site connection is secure" that lacks the data I'm looking for.

Try using a secure connection: https://www.nationstates.net/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0;mode=score

PostPosted: Thu Nov 17, 2022 11:27 pm
by Esfalsa
I was doing some testing with the private command in the NationStates API for making RMB posts and ran into a few issues with text encoding (and believe this is the appropriate place to report it?).

For instance, trying to post the string Héllø wörld — → ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), produces the output Héllø wörld ? ? ? E?da = Q, n ? ?, ? f(i) = ? g(i), ?x??: ?x? = ???x?, ? ? ¬? = ¬(¬? ? ?), (see here).

Code: Select all
curl --request POST \
  --url https://www.nationstates.net/cgi-bin/api.cgi \
  --header 'User-Agent: Esfalsa' \
  --header 'X-Autologin: autologin' \
  --header 'X-Pin: pin' \
  --header 'content-type: application/x-www-form-urlencoded; charset=utf-8' \
  --data nation=testy_mctestface \
  --data region=region_mcregionface \
  --data c=rmbpost \
  --data 'text=Héllø wörld — → ∮ E⋅da = Q,  n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β),' \
  --data mode=prepare

Code: Select all
curl --request POST \
  --url https://www.nationstates.net/cgi-bin/api.cgi \
  --header 'User-Agent: Esfalsa' \
  --header 'X-Autologin: autologin' \
  --header 'X-Pin: pin' \
  --header 'content-type: application/x-www-form-urlencoded; charset=utf-8' \
  --data nation=testy_mctestface \
  --data region=region_mcregionface \
  --data c=rmbpost \
  --data 'text=Héllø wörld — → ∮ E⋅da = Q,  n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β),' \
  --data mode=execute \
  --data token=2wp0ZbW9wCSW4E1LvNkNmryAK3K8cbhVaLx9aFR7TrA

PostPosted: Thu Nov 17, 2022 11:30 pm
by United Calanworie
Esfalsa wrote:I was doing some testing with the private command in the NationStates API for making RMB posts and ran into a few issues with text encoding (and believe this is the appropriate place to report it?).

For instance, trying to post the string Héllø wörld — → ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), produces the output Héllø wörld ? ? ? E?da = Q, n ? ?, ? f(i) = ? g(i), ?x??: ?x? = ???x?, ? ? ¬? = ¬(¬? ? ?), (see here).

Code: Select all
curl --request POST \
  --url https://www.nationstates.net/cgi-bin/api.cgi \
  --header 'User-Agent: Esfalsa' \
  --header 'X-Autologin: autologin' \
  --header 'X-Pin: pin' \
  --header 'content-type: application/x-www-form-urlencoded; charset=utf-8' \
  --data nation=testy_mctestface \
  --data region=region_mcregionface \
  --data c=rmbpost \
  --data 'text=Héllø wörld — → ∮ E⋅da = Q,  n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β),' \
  --data mode=prepare

Code: Select all
curl --request POST \
  --url https://www.nationstates.net/cgi-bin/api.cgi \
  --header 'User-Agent: Esfalsa' \
  --header 'X-Autologin: autologin' \
  --header 'X-Pin: pin' \
  --header 'content-type: application/x-www-form-urlencoded; charset=utf-8' \
  --data nation=testy_mctestface \
  --data region=region_mcregionface \
  --data c=rmbpost \
  --data 'text=Héllø wörld — → ∮ E⋅da = Q,  n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β),' \
  --data mode=execute \
  --data token=2wp0ZbW9wCSW4E1LvNkNmryAK3K8cbhVaLx9aFR7TrA

RMB posts are in windows 1252, at least according to my brief check. Try that?

PostPosted: Fri Nov 18, 2022 12:04 am
by Trotterdam
The RMB accepts UTF-8 when posted through the manual form, though (proof). It seems to be an inconsistency between the manual interface and the API.

Esfalsa is already specifying the intended character encoding of the POST data in the request, so unless there's something about how this is supposed to be specified in the HTTP standard that I'm unaware of, the API is being non-compliant by ignoring the "charset=utf-8" specifier.

PostPosted: Fri Nov 18, 2022 12:58 am
by Esfalsa
To clarify, the reason I posted was that my understanding from a prior conversation on Discord is that site staff is currently working towards UTF-8 support and that I should make a post if anything doesn't work with that.

That said, thanks for taking a look Aav — it's good to know what's currently supported. Characters supported by Windows 1252 do seem to output fine (even with charset=utf-8 in the Content-Type header). I did some further testing and it seems HTML escape sequences work fine too, so that's a workaround for now I suppose.

PostPosted: Fri Nov 18, 2022 1:15 am
by Trotterdam
Esfalsa wrote:Characters supported by Windows 1252 do seem to output fine (even with charset=utf-8 in the Content-Type header).
Hmm, wait. So you're submitting them as UTF-8 characters, rather than in their Windows-1252 representations, but they work so long as they happen to be Windows-1252 characters too? That suggests there's some kind of "double conversion" issue going on, with the input being converted from UTF-8 to Windows-1252 and then back from Windows-1252 to UTF-8.

Esfalsa wrote:I did some further testing and it seems HTML escape sequences work fine too, so that's a workaround for now I suppose.
Which shouldn't work, since HTTP POST data isn't HTML data. It's erroneous for ampersands to not be preserved literally.

Previous times this topic has come up:
http://forum.nationstates.net/viewtopic.php?f=15&t=483646
http://forum.nationstates.net/viewtopic.php?f=15&t=514105

Also, while on the subject of character encodings and the proper way to escape them, while it's an extremely minor thing, I would still like to bring up this old report of mine, where the reply data from the API incorrectly uses a JavaScript/JSON/etc. escape where an XML escape is expected.

PostPosted: Sat Nov 19, 2022 9:54 pm
by Racoda
Estingberg wrote:Another Question; why on earth is
head={"UserAgent":"****************"}
info=requests.post("http://www.nationstates.net/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0;mode=score",
headers=head)


Producing this garbage data:
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aaf443e97618c8')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=qaAZGw5U1FKvv01ZSTG7u2gShHGhfRzIBdR8raC76tM-1665862067-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="YcNPoOpZ5bwJT5Gf5UGAjFqoM_s7U9myXGVj0q92Qn4-1665862067-0-AXHYiRE0f8AGobpgxAs1ZH9RiNJVx66HS-cTzVL5BsX_qQlZRxMSCeN1gG14QBt_E7-Cjl4TZtCa2BWf-cpg4by98gP1gg0IGYxXk-6Ipq2He8_OsfpwDUGyKliPvAzBJGi1VLHpoIZes95ufAGx4Ar0i0DbUd2T2sdqXjepn7C40B8ZoxZYme_uAg0wHlMxXdqJujWKcx3stEX0wMNBWDcb0UCnNTylqxz0VEmw1qcFJKYxR-mym3AcKJoof8sNNEqlrSNNmEG1Io4tt_aU8sJWD0fWBcl6KebEzk7ItG0UJe8QOE1XlZLnuwPaq6GnRA-LQw6PrWWUYm
PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60447' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aaf8cf9d9817f5')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/cgi-bin/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="UiWDVMj6mT3Yj7r4Px4eZKzf8EchZIPaE9tlO0ciknA-1665862254-0-AcwijUv0gsXTq_H5qbPEyCklKdHk0Z9C8BRJGAHn7a3ZLA882oIxGbQvowyXgbDULREVi_KZ1d9nhJGwIUQSza8TEpCsmTJWGnXVQXPoqh00TQ5FgfIEmrn9_byS86rIREdLENTMBRFpizWFqpvRYJ6O_8HMunrve8j7a_ZPPePg4Fx5KHgQHut7a_SDtRPMVUaGnbZm0Rk4E1fvC_3pf6919f5hhItnbCfslueAGljr5VLT_E84peaZJ2Asnuhz-x65DFOYrDe5DJOBSiuf0eSf1282B2IwlNDhtgtY_6D5PtimLR_ALkGUteJ2otkEpPGN2oaMZ7vl5Kc83RzPVyDc1b5YFKL0lEM-quoenDlQOryVHe2cByiYyrLBvg3EPA65CmFFVRb4uBtY5-ZoNVxZ7u8gWBCkzRFyp-c5DECUVgS7myUrjbcInxGrPTkvCFo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vpMe34BiP+khuZ+OHpZ9xAJUsJe5w=="/>
</form>
</div>
</div>
<script>
(function(){
window._cf_chl_opt={
cvId: '2',
cType: 'managed',
cNounce: '5018',
cRay: '75aaf8cf9d9817f5',
cHash: '218306b50365a43',
cUPMDTk: "\/cgi-bin\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0",
cFPWv: 'g',
cTTimeMs: '1000',
cTplV: 4,
cTplB: 'cf',
cRq: {
ru: 'aHR0cDovL3d3dy5uYXRpb25zdGF0ZXMubmV0L2NnaS1iaW4vYXBpLmNnaT9uYXRpb249ZXN0aW5nYmVyZztxPWNlbnN1cztzY2FsZT0wJTIwJTIwJTIwJTIwJTIwO21vZGU9c2NvcmU=',
ra: 'cHl0aG9uLXJlcXVlc3RzLzIuMjUuMQ==',
rm: 'UE9TVA==',
d: 'iMaadKnRq8lcj1O/BHc7M5IKDw0P4ZwJ4L5XTEi1de7AMlzPy/1avEaxAJJUhUQxhM+Tza+AfgIo+ylXM1K1ncekLbcXRtplzOdV/YoW9NxnvVoU/f95z/lRaK5b1V8/VeW1bJF/92qT7KRCdMHs32QM2BXxymKiykDYhj8eHKd9fArEfYtJqerFySKvo9Lfbx7ZoneHz2Iblj1Kh/KqUD58a2jLXemOsWzp8klLguxfiINweoV5s5wv5iA+OoOc9fUuj5X4FqIDXITKe9mM7Fu8+vtO7n2KgpwssPoABTTjna+soEWstFa2gRUji9o+hIZynJOfSSqdph/GVMSJgZxqpC8+qdmjoWzGK5LCS2qvohDFcJdCh7oJPnLMnsuBp9GBLbI1sauLFVDfyyWPQVR6ImK26fPQJQ/7k8ZuBTKr7eQwj6SPa9ZEV2ZSNNdYc8k7de7GgtU/KsHVAQZvdmindYRx1cbvlVc3qSscrNx2Oa0VvvK2WX0Ae4Kx7K/wmYEspU3sMu66HvJ2x12+xJmsXr3lrxg/N8t29lz4M4R8UGLqMIhZlwzPdZn4+kejNrYRP6QP2UAVUfvXoVQmm9Htn+DHUbwPBu84Ys+RkJW2tvaaI2k1TLcX2JODzP+hiNr9OEUuSnqqSV6jkrKR4w==',
t: 'MTY2NTg2MjI1NC4wMjMwMDA=',
m: '1F3IAe1M7tDWHjgMHedrrbuvezBj75qqN4VZoyN+7Bs=',
i1: 'PXBwz5/U23SdZ6HZV4tBoQ==',
i2: '5qcHUAS1hEL9hxTWZSTuzQ==',
zh: 'B3j7jvkb6SpbC7cpPha9Fxw1RQntpO1XX0YD0OxCNf0=',
uh: '5GU+jYv2xJ+bCaE/ARmi/DORbiS/v56CW7E0TH4XWQk=',
hh: 'j/qeecdtcvB7nDzYaem6Np88JS3WCwPWX/VL84dFkD0=',
}
};
var trkjs = document.createElement('img');
trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=75aaf8cf9d9817f5');
trkjs.setAttribute('style', 'display: none');
document.body.appendChild(trkjs);
var cpo = document.createElement('script');
cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/managed/v1?ray=75aaf8cf9d9817f5';
window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;
if (window.history && window.history.replaceState) {
var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
history.replaceState(null, null, "\/cgi-bin\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_rt_tk=Xv_rwb2SHL0OukkOx5Wpw_anh2xwgWN52xTLA1G_Iug-1665862254-0-gaNycGzNAr0" + window._cf_chl_opt.cOgUHash);
cpo.onload = function() {
history.replaceState(null, null, ogU);
};
}
document.getElementsByTagName('head')[0].appendChild(cpo);
}());
</script>

<div class="footer" role="contentinfo">
<div class="footer-inner">
<div class="clearfix diagnostic-wrapper">
<div class="ray-id">Ray ID: <code>75aaf8cf9d9817f5</code></div>
</div>
<div class="text-center">Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
</div>
</div>
</body>
</html>

PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60507' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
Traceback (most recent call last):
File "c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py", line 4, in <module>
info=requests.post("http://www.nationstates.net/api.cgi?nation=estingberg;q=census;scale=0 \
File "C:\Users\aidan\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Users\aidan\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
TypeError: Session.request() got an unexpected keyword argument 'headerS'
PS C:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode> c:; cd 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\.vscode'; & 'C:\Users\aidan\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\aidan\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '60519' '--' 'c:\Users\aidan\OneDrive\Desktop\PythonPrograms\civiltest.py'
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Just a moment...</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="/cdn-cgi/styles/challenges.css" rel="stylesheet" />


</head>
<body class="no-js">
<div class="main-wrapper" role="main">
<div class="main-content">
<h1 class="zone-name-title h1">
<img class="heading-favicon" src="/favicon.ico"
onerror="this.onerror=null;this.parentNode.removeChild(this)" />
http://www.nationstates.net
</h1>
<h2 class="h2" id="challenge-running">
Checking if the site connection is secure
</h2>
<noscript>
<div id="challenge-error-title">
<div class="h2">
<span class="icon-wrapper">
<div class="heading-icon warning-icon"></div>
</span>
<span id="challenge-error-text">
Enable JavaScript and cookies to continue
</span>
</div>
</div>
</noscript>
<div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=75aafb50ba58c409')"></div>
<div id="challenge-body-text" class="core-msg spacer">
http://www.nationstates.net needs to review the security of your connection before proceeding.
</div>
<form id="challenge-form" action="/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&amp;__cf_chl_f_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0" method="POST" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="md" value="l4tpARlZ.ge.lfq6TFOtW_oOfgPKMFCNwi0hP.1GSaM-1665862356-0-ASz27JC8pfmaWX0enimh7zTIBTCyq3-t2mbNHpYa-dhnuh1p7YtbpZrkeJfyFH9i9YQMbGMNafeGHHQUT-7dTJyblXTfAvWPwUx850Dnn2TklL-3AdLaGQIe186UZToEukbJo1mSDuMpKvsQuMSNOZUDMpyUcQ7XjbJNhl91iRnWjZwg8OQ-zuQzsfXBfe1t9ovIxQNFGVNeh9CF5Q4IAHMSYuDQmitZN9QtaGOSvY5TnsLBJKeFcCVhAlr7aeGcjT5SQFWF_xBCEF8ag_dUeYPENfCyAAf1KjyGBWoVhUR1QVFjXBIwlCNZM-sf0w6ETkY5DOPk9DmLbS0kZ1-rsZE6CNNbkoxweZM5Ki2jPvAm5Zbc9p0KNdi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WJ3M3WYpdy+9XCzcdJyLoAvMv8KGipAKV8nr/cqozMVO87jl+5vCNMRpnOjZ/YUhDHhUJi9TYeYqUB9+80F45bZmZNj7uNal1g=="/>
</form>
</div>
</div>
<script>
(function(){
window._cf_chl_opt={
cvId: '2',
cType: 'managed',
cNounce: '67',
cRay: '75aafb50ba58c409',
cHash: '482a02faa6b5131',
cUPMDTk: "\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0",
cFPWv: 'g',
cTTimeMs: '1000',
cTplV: 4,
cTplB: 'cf',
cRq: {
ru: 'aHR0cDovL3d3dy5uYXRpb25zdGF0ZXMubmV0L2FwaS5jZ2k/bmF0aW9uPWVzdGluZ2Jlcmc7cT1jZW5zdXM7c2NhbGU9MCUyMCUyMCUyMCUyMCUyMDttb2RlPXNjb3Jl',
ra: 'cHl0aG9uLXJlcXVlc3RzLzIuMjUuMQ==',
rm: 'UE9TVA==',
d: 'UfXoQ98vEy31OGqMpbqWYDE4AHvIM8AIdEbgQ2Lfttn6bAmvpiVoWYOPe5FAulHdcO5C4fILUbvg7ln9ybo7OWKPYYug29IAKWJxVbvPSjqlinLDTVSSEsmNIJfnJtlCp6mb8d61cUtsjcwsCd/SGyKWua0pMFmKF78hvpl+JvTjPiS+qbnr/xyvi+a21ULXhzbd5GMpZYkCO5IknG6MIKoitk/2CUg31InfuUj8v5dYyQRxppTXD3SlrrQSF1/ouIaupBWwH6SLekeviB/ngRq/EXgosMZg61+vpvq7mfJxNYLmXTp3J4Mu2SIHZHskmmA7OPBUb6DLF20jDJaTogEIFDr+c2cLO32tSPdDGFJWgqROAvVThz67SP1ZjWE3yPuyT65PmW5jk/f6Gdf7uW0o0vPGpE7IfykljmZS3L8lBHy0h9nbXqlesoEp1Aa4NEBajgp4dcdJkS0iRAQ4OaaZWtUAvmRiBlWjQyl2mTrihvtc3u99dBeFtrd5LVDyukDLv8W9BqTFR3JRGaWVkMgU83mxOxVRcBCzScvwhImv9D0+NwpqtThfGXY1j1DIODHXqsAyygRRzTGsRNb5sXPdSKedTyEKtWsW7peD8INKsB0pG+9P6jTfRuwJMfMNzOBH/cNgIKhObLloOBEpxQ==',
t: 'MTY2NTg2MjM1Ni42MTEwMDA=',
m: 'BbDJs0idPFp/PVcLwnYsHHuUpoMnAq0HQOxND0BEwf4=',
i1: 'q+lrbfJp+zVCjo/ZOBh9rw==',
i2: 'Tj7KBksfnWyDHhEZB8rRxg==',
zh: 'B3j7jvkb6SpbC7cpPha9Fxw1RQntpO1XX0YD0OxCNf0=',
uh: '5GU+jYv2xJ+bCaE/ARmi/DORbiS/v56CW7E0TH4XWQk=',
hh: 'j/qeecdtcvB7nDzYaem6Np88JS3WCwPWX/VL84dFkD0=',
}
};
var trkjs = document.createElement('img');
trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=75aafb50ba58c409');
trkjs.setAttribute('style', 'display: none');
document.body.appendChild(trkjs);
var cpo = document.createElement('script');
cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/managed/v1?ray=75aafb50ba58c409';
window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, -window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;
if (window.history && window.history.replaceState) {
var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
history.replaceState(null, null, "\/api.cgi?nation=estingberg;q=census;scale=0%20%20%20%20%20;mode=score&__cf_chl_rt_tk=1GCzRpoymVtVBo3tzMavawJqZt8bzB26HZC79X_2Cjk-1665862356-0-gaNycGzNAr0" + window._cf_chl_opt.cOgUHash);
cpo.onload = function() {
history.replaceState(null, null, ogU);
};
}
document.getElementsByTagName('head')[0].appendChild(cpo);
}());
</script>

<div class="footer" role="contentinfo">
<div class="footer-inner">
<div class="clearfix diagnostic-wrapper">
<div class="ray-id">Ray ID: <code>75aafb50ba58c409</code></div>
</div>
<div class="text-center">Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=challenge&utm_campaign=m" target="_blank">Cloudflare</a></div>
</div>
</div>
</body>
</html>

A summary of the data is that it's an html page from Cloudflare saying "Checking if the site connection is secure" that lacks the data I'm looking for.

I'm a little late to the party, but you should by setting a User-Agent header, not UserAgent. That's the likely issue here.

PostPosted: Sun Nov 27, 2022 4:26 pm
by [violet]
Estingberg wrote:A summary of the data is that it's an html page from Cloudflare saying "Checking if the site connection is secure" that lacks the data I'm looking for.

I think that's a page that CloudFlare throws up when it finds the request particularly suspicious.

We have disabled all the anti-bot stuff we can on the API, but you can still trigger a CloudFlare check for mysterious reasons based on where you are, what it knows about you, and what you seem to be trying to do. Sometimes I think it happens just because your query coincidentally looks a bit like a known hack.

PostPosted: Tue Nov 29, 2022 12:20 am
by Vistulange
Just to be clear, the API is solely for the gameside of things, yes? That is to say, I wouldn't be able to use it to web scrape the forums?

PostPosted: Tue Nov 29, 2022 8:48 am
by Roavin
Vistulange wrote:Just to be clear, the API is solely for the gameside of things, yes? That is to say, I wouldn't be able to use it to web scrape the forums?


That is correct. Please keep in mind that scraping the forums manually must abide by the Script Rules and is unsupported and frowned upon for anything more than a small amount.

PostPosted: Tue Nov 29, 2022 2:42 pm
by Vistulange
Roavin wrote:
Vistulange wrote:Just to be clear, the API is solely for the gameside of things, yes? That is to say, I wouldn't be able to use it to web scrape the forums?


That is correct. Please keep in mind that scraping the forums manually must abide by the Script Rules and is unsupported and frowned upon for anything more than a small amount.

Alright, thank you, that was very informative!

PostPosted: Wed Dec 07, 2022 12:33 pm
by The Ice States
Could there be a region shard added to the API to view authorised recruiters for a region?

PostPosted: Sat Dec 24, 2022 9:09 am
by Notanam
Hey, I know all eyes are on the other part of the technical forum right now, but I'd like to know if functionality for changing a nation's settings are being worked on. More specifically, I'd like there to be a private shard that works similarly to ?nation= for a nation's settings, as well as some sort of private command to change said settings. This would help me with a project I'm working on. Thanks!

I'll get a formal API request up later if no one's done it before.

PostPosted: Wed Jan 11, 2023 10:28 pm
by The Ice States
The Ice States wrote:Could there be a region shard added to the API to view authorised recruiters for a region?

Bumping this request.