Merge pull request #231 from dotcloud/ping_support

Added Client.ping() method
This commit is contained in:
Joffrey F 2014-05-27 16:36:14 -07:00
commit b629f9d7ec
2 changed files with 10 additions and 0 deletions

View File

@ -170,6 +170,13 @@ The `logs` function is a wrapper around this one, which you can use
instead if you want to fetch/stream container output without first
retrieving the entire backlog.
```python
c.ping()
```
Hits the /_ping endpoint of the remote API and returns the result.
An exception will be raised if the endpoint isn't responding.
```python
c.port(container, private_port)
```

View File

@ -616,6 +616,9 @@ class Client(requests.Session):
logs=True
)
def ping(self):
return self._result(self._get(self._url('/_ping')))
def port(self, container, private_port):
if isinstance(container, dict):
container = container.get('Id')