Title: Unclosed Session/SSLSocket · Issue #29 · massive-com/client-python · GitHub
Open Graph Title: Unclosed Session/SSLSocket · Issue #29 · massive-com/client-python
X Title: Unclosed Session/SSLSocket · Issue #29 · massive-com/client-python
Description: When I run the following python code with a debugger attached - polygon_api = polygon.RESTClient() response = polygon_api.stocks_equities_aggregates('AAPL', 30, 'minute', '2020-06-30', '2020-06-30') I get a post-run warning from my debug...
Open Graph Description: When I run the following python code with a debugger attached - polygon_api = polygon.RESTClient() response = polygon_api.stocks_equities_aggregates('AAPL', 30, 'minute', '2020-06-30', '2020-06-30'...
X Description: When I run the following python code with a debugger attached - polygon_api = polygon.RESTClient() response = polygon_api.stocks_equities_aggregates('AAPL', 30, 'minute', '2020-...
Opengraph URL: https://github.com/massive-com/client-python/issues/29
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unclosed Session/SSLSocket","articleBody":"When I run the following python code with a debugger attached -\r\n```\r\npolygon_api = polygon.RESTClient()\r\nresponse = polygon_api.stocks_equities_aggregates('AAPL', 30, 'minute', '2020-06-30', '2020-06-30')\r\n```\r\nI get a post-run warning from my debugger -\r\n```\r\nResourceWarning: unclosed \u003cssl.SSLSocket type=SocketKind.SOCK_STREAM, raddr=('38.133.177.84', 443)\u003e\r\n```\r\nBut if I run -\r\n```\r\npolygon_api = polygon.RESTClient()\r\nresponse = polygon_api.stocks_equities_aggregates('AAPL', 30, 'minute', '2020-06-30', '2020-06-30')\r\npolygon_api._session.close()\r\n```\r\nThe polygon client cleans up and my debugger is happy.\r\n\r\nLooking into why this is, `Session` will only call its own `close()` from its `__exit__` method, which is only called if the class is being used as a context manager (e.g. using `with Session() as s:` statement, as suggested by [their docs](https://requests.readthedocs.io/en/master/user/advanced/#session-objects)) - and RESTClient is not using it in this manner, so `close()` is just never being called and resources are being left open.\r\n\r\n","author":{"url":"https://github.com/sky-coding","@type":"Person","name":"sky-coding"},"datePublished":"2020-07-01T17:18:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/29/client-python/issues/29"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3821c531-2f9a-ed8f-1ae6-d5a90221fe4a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E438:3861F:B84D7B:FABD53:6A4D5474 |
| html-safe-nonce | 7e1db6e0fbabaec4a24d51519d2aeb573c6f90077e42341404638b5a1179b70b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDM4OjM4NjFGOkI4NEQ3QjpGQUJENTM6NkE0RDU0NzQiLCJ2aXNpdG9yX2lkIjoiNzIwMTY5NzY3MjE4NDI4ODM3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c83b48a9e8ad44e8290bf2e71d863209e49161decd3dd107c2c7e55db3163dde |
| hovercard-subject-tag | issue:649144519 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/massive-com/client-python/29/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9cab417ae3956cdcbe2afea44608094e13b91d093022fedc093d84aaed631b7b/massive-com/client-python/issues/29 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9cab417ae3956cdcbe2afea44608094e13b91d093022fedc093d84aaed631b7b/massive-com/client-python/issues/29 |
| og:image:alt | When I run the following python code with a debugger attached - polygon_api = polygon.RESTClient() response = polygon_api.stocks_equities_aggregates('AAPL', 30, 'minute', '2020-06-30', '2020-06-30'... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sky-coding |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2a1443ff9733a3016431263ea73c93d8fe00c195eb4a7670ac30e7848f045441 |
| turbo-cache-control | no-preview |
| go-import | github.com/massive-com/client-python git https://github.com/massive-com/client-python.git |
| octolytics-dimension-user_id | 191946194 |
| octolytics-dimension-user_login | massive-com |
| octolytics-dimension-repository_id | 216660192 |
| octolytics-dimension-repository_nwo | massive-com/client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 216660192 |
| octolytics-dimension-repository_network_root_nwo | massive-com/client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3bdd3157ea1f0fd738d408eceeead721acf1dc3 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width