forked from embedly/embedly-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
19 lines (15 loc) · 707 Bytes
/
models.py
File metadata and controls
19 lines (15 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from __future__ import absolute_import, unicode_literals
from .py3_utils import python_2_unicode_compatible, IterableUserDict
@python_2_unicode_compatible
class Url(IterableUserDict, object):
"""
A dictionary with two additional attributes for the method and url.
UserDict provides a dictionary interface along with the regular
dictionary accessible via the `data` attribute.
"""
def __init__(self, data=None, method=None, original_url=None, **kwargs):
super(Url, self).__init__(data, **kwargs)
self.method = method or 'url'
self.original_url = original_url
def __str__(self):
return '<%s %s>' % (self.method.title(), self.original_url or "")