Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8392487
views.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
638 B
Subscribers
None
views.py
View Options
from
django.http
import
HttpResponse
from
django.http
import
Http404
from
.models
import
Client
def
index
(
request
):
return
HttpResponse
(
'SWH Deposit API - WIP'
)
def
clients
(
request
):
"""List existing clients.
"""
cs
=
Client
.
objects
.
all
()
return
HttpResponse
(
'Clients:
%s
'
%
','
.
join
((
str
(
c
)
for
c
in
cs
)))
def
client
(
request
,
client_id
):
"""List information about one client.
"""
c
=
Client
.
objects
.
filter
(
pk
=
client_id
)
.
all
()
if
len
(
c
)
<=
0
:
raise
Http404
(
'Client with id
%s
not found'
%
client_id
)
c
=
c
[
0
]
return
HttpResponse
(
'Client {id:
%s
, name:
%s
}'
%
(
c
.
id
,
c
.
name
))
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Jun 4 2025, 6:59 PM (10 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3398901
Attached To
rDDEP Push deposit
Event Timeline
Log In to Comment