SessionManager: Provide default instance?
See original GitHub issueThis is more thinking ahead and depends on #849 but something I want to discuss:
Would be nice if users could do:
from urllib3 import http # or maybe `session` or `default` or something?
r= http.request('GET', whatever)
Two questions:
- Is it safe to provide a default instance (or magic property) of SessionManager for people to use? Need to consider single-threaded, multi-threaded, and possibly multi-process (this actually might be more safe in a multi-process environment than our current approach where people might accidentally re-use a late-instantiated pool).
- What should it be named?
I like using
httpin all of the examples likehttp = PoolManager(),http = ConnectionPool()etc., sohttpfeels natural to me as a default instance you make http requests through, but I’m open to other ideas. Originally, we used to usepool = PoolManager()but I thinkhttpis more friendly in practice.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
AWS Systems Manager Session Manager
With Session Manager, you can manage your Amazon Elastic Compute Cloud (Amazon EC2) instances, edge devices, and on-premises servers and virtual machines (VMs)....
Read more >How to set up AWS Session Manager
Because Session Manager by default uses ssm-user with sudo privileges it's worth considering if it's not too much elevated privilege for users ...
Read more >Session Manager
Session Manager provides secure and auditable instance management without the need to open inbound ports, maintain bastion hosts, or manage SSH keys.
Read more >Session Manager
The session manager has two main functions: It creates instances of these sessions, and it ensures that only a single instance of each...
Read more >Connecting to Managed Instances Using SSM Session Manager
aws ssm create-activation --default-instance-name MyOnPremInstance --iam-role SSMServiceRoleForActivation --registration-limit 1.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I like it! One (completely nonfunctional) thought - maybe have it in the docs as
It’d behave exactly the same way, and people could obviously still do things the
from-importway, but it might help create an unconscious association that the state of that particularSessionManageris embedded in urllib3 as a package, rather than in any particular import of it - does that make sense at all?I definitely do like exposing that static method more than I do exposing a default session with no abstraction; this way, we can even specifically mark the default session as private (
_default_session) so that people aren’t tempted to fiddle with it and mess up the state of another urllib3 consumer in the same process.Going to close this as
SessionManagerisn’t being developed currently.