Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-sshkey
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1c2d5cd8
authored
Jun 28, 2014
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make key_parse() return KeyInfo namedtuple
parent
0bac8180
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
django_sshkey/util.py
+5
-1
No files found.
django_sshkey/util.py
View file @
1c2d5cd8
...
...
@@ -26,8 +26,12 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from
collections
import
namedtuple
SSHKEY_LOOKUP_URL_DEFAULT
=
'http://localhost:8000/sshkey/lookup'
KeyInfo
=
namedtuple
(
'KeyInfo'
,
'type b64key comment fingerprint'
)
class
SSHKeyFormatError
(
Exception
):
def
__init__
(
self
,
text
):
self
.
text
=
text
...
...
@@ -91,7 +95,7 @@ def key_parse(text):
fp
=
hashlib
.
md5
(
key
)
.
hexdigest
()
fp
=
':'
.
join
(
a
+
b
for
a
,
b
in
zip
(
fp
[::
2
],
fp
[
1
::
2
]))
return
(
type
,
b64key
,
comment
,
fp
)
return
KeyInfo
(
type
,
b64key
,
comment
,
fp
)
def
lookup_all
(
url
):
import
urllib
...
...
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