create a sans-io docker client class and impliment Client with blocking requests
See original GitHub issueuse https://github.com/mikeal/deferred to create a sans-io version of Client (SansIOClient) that requires something like:
class SimpleStream(object):
def next(self) -> Deferred:
...
class IOAdapter(object):
def request(self, **kwargs) -> Deferred:
...
def stream(self, **kwargs) -> SimpleStream:
...
def unwrap_deferred(self, deferred: Deferred) -> Any:
...
and then implement it with something like:
class BlockingSimpleStream(SimpleStream):
def __init__(self, stream):
self.generator = _stream_helper(stream):
def next(self) -> Deferred:
return deferred.succeeded(next(self.generator))
class BlockingIOAdapter(IOAdapter):
def __init__(session: requests.Session):
self.session = session
def request(self, **kwargs) -> Deferred:
return deferred.execute(self.session.request, **kwargs)
def stream(self, **kwargs) -> BlockingSimpleStream:
return BlockingSimpleStream(self.session.request(**kwargs, stream=True))
def unwrap_deferred(self, d: Deferred):
return deferred.waitForDeferred(d).getResult()
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Examples using the Docker Engine SDKs and Docker API
This first example shows how to run a container using the Docker API. On the command line, you would use the docker run...
Read more >Client API - docker-py Documentation - Read the Docs
To instantiate a Client class that will allow you to communicate with a ... Return a blocking generator you can iterate over to...
Read more >Docker Java - GitHub
Java Docker API Client. Contribute to docker-java/docker-java development by creating an account on GitHub.
Read more >FOR608: Enterprise-Class Incident Response & Threat Hunting
Learn analysis techniques for responding to Linux and Mac operating systems; Analyze containerized microservices such as Docker containers; Correlate and ...
Read more >Backend only works in localhost React + Springboot + docker
The React Frontend normally runs in the clients browser (If you don't ... class MyCrossOriginController { // this should now allow requests ......
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 FreeTop 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
Top GitHub Comments
I made a small attempt here to get docker-py asynchronous: https://github.com/tenforce/docker-py-aiohttp This is actually a wrapper around docker-py. I suppose it’s not really what you want, especially since it is strongly bound to aiohttp and I think you want something more generic right?
@shin- is this something you guys would be interesting? It would take me a little bit of work up-front, so I’d like to know if this feature is something you would be interested in having.