Answers for "how do i connect to the nation api on PNW"

1

how do i connect to the nation api on PNW

#NOTE: This is for python applications
import requests, json

nationID = "nationID you want data on"
apikey = "Your PNW api key (found on the account page)"

nationreq = requests.get(f"https://politicsandwar.com/api/nation/id={nationID}&key={apikey}")
nationreq = nationreq.json()

print(nationreq)

cityids = nationreq["cityids"]
nationid = nationreq["nationid"]
nation_name = nationreq["name"]
nation_prename = nationreq["prename"]
uniqueid = nationreq["uniqueid"]

print(f"{cityids} {nationid} {nation_name} {nation_prename} {uniqueid}")
Posted by: Guest on March-29-2021

Code answers related to "how do i connect to the nation api on PNW"

Python Answers by Framework

Browse Popular Code Answers by Language