add monthly, quarterly, annual dbcode
This commit is contained in:
parent
dc35cbc284
commit
cc362bedfb
|
@ -85,18 +85,28 @@ class NBSCData(object):
|
||||||
"name":self.name, "pid":self.pid, "wdcode":self.wdcode})
|
"name":self.name, "pid":self.pid, "wdcode":self.wdcode})
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def download_data(self, nid:str=None, sj="1978-"):
|
|
||||||
|
|
||||||
|
def download_data(self, nid:str=None, sj="1978-", period:str="monthly"):
|
||||||
|
|
||||||
|
if period == "monthly":
|
||||||
|
dbcode="hgyd"
|
||||||
|
elif period == "quarterly":
|
||||||
|
dbcode="hgjd"
|
||||||
|
elif period == "annual":
|
||||||
|
dbcode="hgnd"
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"dbcode": "hgnd",
|
|
||||||
"rowcode": "zb",
|
|
||||||
"m": "QueryData",
|
"m": "QueryData",
|
||||||
|
"dbcode": dbcode,
|
||||||
|
"rowcode": "zb",
|
||||||
"colcode": "sj",
|
"colcode": "sj",
|
||||||
"wds": "[]",
|
"wds": "[]",
|
||||||
"dfwds": '[{"wdcode":"zb","valuecode":"'
|
"dfwds": '[{"wdcode":"zb","valuecode":"'
|
||||||
+ nid
|
+ nid
|
||||||
+ '"},{"wdcode":"sj","valuecode":"'
|
+ '"},{"wdcode":"sj","valuecode":"'
|
||||||
+ sj
|
|
||||||
+ '"}]',
|
+ '"}]',
|
||||||
|
"sj": sj
|
||||||
}
|
}
|
||||||
r = requests.get(self.url, params=params, verify=False, headers=self.generate_header())
|
r = requests.get(self.url, params=params, verify=False, headers=self.generate_header())
|
||||||
if r.ok:
|
if r.ok:
|
||||||
|
|
Loading…
Reference in New Issue