how do i connect to the nation api on pnw

Solutions on MaxInterview for how do i connect to the nation api on pnw by the best coders in the world

showing results for - "how do i connect to the nation api on pnw"
Bautista
15 May 2018
1#NOTE: This is for python applications
2import requests, json
3
4nationID = "nationID you want data on"
5apikey = "Your PNW api key (found on the account page)"
6
7nationreq = requests.get(f"https://politicsandwar.com/api/nation/id={nationID}&key={apikey}")
8nationreq = nationreq.json()
9
10print(nationreq)
11
12cityids = nationreq["cityids"]
13nationid = nationreq["nationid"]
14nation_name = nationreq["name"]
15nation_prename = nationreq["prename"]
16uniqueid = nationreq["uniqueid"]
17
18print(f"{cityids} {nationid} {nation_name} {nation_prename} {uniqueid}")