Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
48ed4a1d
Kaydet (Commit)
48ed4a1d
authored
Tem 05, 2013
tarafından
Sebastian Vetter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add python 3 support
üst
b7e1ac70
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
10 deletions
+23
-10
.gitignore
.gitignore
+3
-0
client.py
docker/client.py
+9
-4
setup.py
setup.py
+1
-1
test.py
tests/test.py
+4
-5
tox.ini
tox.ini
+6
-0
No files found.
.gitignore
Dosyayı görüntüle @
48ed4a1d
build
dist
*.egg-info
*.egg/
*.pyc
*.swp
.tox
docker/client.py
Dosyayı görüntüle @
48ed4a1d
import
json
import
logging
import
re
import
six
import
shlex
from
StringIO
import
StringIO
if
six
.
PY3
:
from
io
import
StringIO
else
:
from
StringIO
import
StringIO
import
requests
from
requests.exceptions
import
HTTPError
...
...
@@ -43,7 +48,7 @@ class Client(requests.Session):
def
_container_config
(
self
,
image
,
command
,
hostname
=
None
,
user
=
None
,
detach
=
False
,
stdin_open
=
False
,
tty
=
False
,
mem_limit
=
0
,
ports
=
None
,
environment
=
None
,
dns
=
None
,
volumes
=
None
,
volumes_from
=
None
):
if
isinstance
(
command
,
basestring
):
if
isinstance
(
command
,
six
.
string_types
):
command
=
shlex
.
split
(
command
)
return
{
'Hostname'
:
hostname
,
...
...
@@ -68,7 +73,7 @@ class Client(requests.Session):
# so we do this disgusting thing here.
data2
=
{}
if
data
is
not
None
:
for
k
,
v
in
data
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
data
):
if
v
is
not
None
:
data2
[
k
]
=
v
...
...
@@ -180,7 +185,7 @@ class Client(requests.Session):
'repo'
:
repository
,
'tag'
:
tag
}
if
type
(
src
)
==
str
or
type
(
src
)
==
unicode
:
if
isinstance
(
src
,
six
.
string_types
)
:
params
[
'fromSrc'
]
=
src
return
self
.
_result
(
self
.
post
(
u
,
None
,
params
=
params
))
...
...
setup.py
Dosyayı görüntüle @
48ed4a1d
...
...
@@ -11,7 +11,7 @@ setup(
version
=
'0.0.5'
,
description
=
"Python client for Docker."
,
packages
=
[
'docker'
],
install_requires
=
[
'requests'
]
+
test_requirements
,
install_requires
=
[
'requests'
,
'six'
]
+
test_requirements
,
zip_safe
=
False
,
classifiers
=
[
'Development Status :: 3 - Alpha'
,
'Environment :: Other Environment'
,
...
...
tests/test.py
Dosyayı görüntüle @
48ed4a1d
import
six
import
unittest
import
time
import
docker
...
...
@@ -66,7 +66,7 @@ class TestImages(BaseTestCase):
class
TestImageIds
(
BaseTestCase
):
def
runTest
(
self
):
res1
=
self
.
client
.
images
(
quiet
=
True
)
self
.
assertEqual
(
type
(
res1
[
0
]),
unicod
e
)
self
.
assertEqual
(
type
(
res1
[
0
]),
six
.
text_typ
e
)
class
TestListContainers
(
BaseTestCase
):
def
runTest
(
self
):
...
...
@@ -230,7 +230,7 @@ class TestPull(BaseTestCase):
self
.
assertIn
(
'Images'
,
info
)
img_count
=
info
[
'Images'
]
res
=
self
.
client
.
pull
(
'joffrey/test001'
)
self
.
assertEqual
(
type
(
res
),
unicod
e
)
self
.
assertEqual
(
type
(
res
),
six
.
text_typ
e
)
self
.
assertEqual
(
img_count
+
2
,
self
.
client
.
info
()[
'Images'
])
img_info
=
self
.
client
.
inspect_image
(
'joffrey/test001'
)
self
.
assertIn
(
'id'
,
img_info
)
...
...
@@ -297,4 +297,4 @@ class TestRunShlex(BaseTestCase):
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
unittest
.
main
()
tox.ini
0 → 100644
Dosyayı görüntüle @
48ed4a1d
[tox]
envlist
=
py26, py27, py32, py33
[testenv]
commands
=
{envpython}
setup.py
install
{envpython}
tests/test.py
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment