question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SessionManager: Provide default instance?

See original GitHub issue

This 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:

  1. 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).
  2. What should it be named? I like using http in all of the examples like http = PoolManager(), http = ConnectionPool() etc., so http feels natural to me as a default instance you make http requests through, but I’m open to other ideas. Originally, we used to use pool = PoolManager() but I think http is more friendly in practice.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
haikugingercommented, Jun 2, 2016

I like it! One (completely nonfunctional) thought - maybe have it in the docs as

import urllib3

r = urllib3.request('GET', 'https://www.google.com/')

It’d behave exactly the same way, and people could obviously still do things the from-import way, but it might help create an unconscious association that the state of that particular SessionManager is 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.

0reactions
sethmlarsoncommented, Nov 13, 2021

Going to close this as SessionManager isn’t being developed currently.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found