Skip to content

Commit ec93d27

Browse files
authored
update readme to match actual example (#40)
1 parent 312af16 commit ec93d27

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,17 @@ from polygon import RESTClient
5050

5151
def 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

5961
if __name__ == '__main__':
6062
main()
63+
6164
```
6265

6366

0 commit comments

Comments
 (0)