GitHub user tonybaloney opened a pull request:
https://github.com/apache/libcloud/pull/862
Bugfix add trailing slashes for Docker hub API client
## Bugfix add trailing slashes for Docker hub API client
### Description
The following code snippet fails
```python
from libcloud.container.utils.docker import HubClient
import libcloud.common.exceptions
import libcloud
with open('blah.txt','w') as boo:
libcloud.enable_debug(boo)
hub = HubClient()
try:
image = hub.get_image('tomcat', '8.0')
except libcloud.common.exceptions.BaseHTTPError as error:
print(dir(error))
print("Waaaaah %s" % error.code)
```
You can see in the logfile
```
# -------- begin 4377133392 request ----------
curl -i -X GET -H 'Host: registry.hub.docker.com' -H 'X-LC-Request-ID:
4377133392' -H 'Content-Type: application/json' -H 'Accept-Encoding:
gzip,deflate' -H 'User-Agent: libcloud/1.0.0 ' --compress
https://registry.hub.docker.com:443/v2/repositories/library/tomcat/tags/8.0
# -------- begin 4377133392:4377127320 response ----------
HTTP/1.1 301 MOVED PERMANENTLY
Transfer-Encoding: chunked
Strict-Transport-Security: max-age=31536000
Server: nginx/1.6.2
Location:
https://registry.hub.docker.com/v2/repositories/library/tomcat/tags/8.0/
Date: Thu, 22 Sep 2016 00:21:23 GMT
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8
0
0
# -------- end 4377133392:4377127320 response ----------
```
### Status
Replace this: describe the PR status. Examples:
- done, ready for review
### Checklist (tick everything that applies)
- [ ] [Code
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
(required, can be done after the PR checks)
- [ ] Documentation
- [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
- [ ]
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
(required for bigger changes)
cc @ArroyoNetworks
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tonybaloney/libcloud fix_docker_hub
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/libcloud/pull/862.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #862
----
commit 81e89f7036a04f6ae19ee2d56ea6567dd1601494
Author: Anthony Shaw <[email protected]>
Date: 2016-09-22T00:30:12Z
add trailing slashes for hub API client
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---