File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -50,14 +50,17 @@ from polygon import RESTClient
5050
5151def main ():
5252 key = " your api key"
53- client = RESTClient(key)
5453
55- resp = client.stocks_equities_daily_open_close(" AAPL" , " 2018-3-2" )
56- print (f " On: { resp.from_} Apple opened at { resp.open} and closed at { resp.close} " )
54+ # RESTClient can be used as a context manager to facilitate closing the underlying http session
55+ # https://requests.readthedocs.io/en/master/user/advanced/#session-objects
56+ with RESTClient(key) as client:
57+ resp = client.stocks_equities_daily_open_close(" AAPL" , " 2018-03-02" )
58+ print (f " On: { resp.from_} Apple opened at { resp.open} and closed at { resp.close} " )
5759
5860
5961if __name__ == ' __main__' :
6062 main()
63+
6164```
6265
6366
You can’t perform that action at this time.
0 commit comments