django-restit 4.1.71__py3-none-any.whl → 4.1.72__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.1.71
3
+ Version: 4.1.72
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -114,7 +114,7 @@ location/migrations/0002_geoip_subnet_alter_geoip_ip.py,sha256=n-oJrEnIqN9VnMhiZ
114
114
  location/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
115
115
  location/models/__init__.py,sha256=rZhldkoKmoJQXjBAK1IIQn7K_OOJvFtIGOGVl_szqbE,230
116
116
  location/models/address.py,sha256=GFMyGg9md0y6Szj6bue7sx7ucVjhOgpwJAaz6lYtQEs,2028
117
- location/models/ip.py,sha256=HZGYG-lchEtU0Stdvb7dXrnOiIqqi_EcCxO3eSIhxUk,3560
117
+ location/models/ip.py,sha256=ramy2mr4pLq_OzwcvLMfVPNEIa0YlAYtJ5l1af7do_8,3619
118
118
  location/models/legacy.py,sha256=8ROsUSZrjGQkUyXeJvoxPdKAWaKfUH-AL9TIeJb7krg,1994
119
119
  location/models/location.py,sha256=01dJPJecbp5orExsIGWOsBC_KkwFRIW0rGDIwyx1r0w,2316
120
120
  location/models/track.py,sha256=OdhRL1KVXlPcZkp4S6QpKc7Ctoth8VjwHs_dlZ8XHI4,1474
@@ -132,7 +132,7 @@ location/providers/timezones/__init__.py,sha256=enslc1cVTju3GKrvpLoAxSHUKkLeREhe
132
132
  location/providers/timezones/google.py,sha256=HyATVCGJ3wHwfc47jQRLnwa8nPeBlmpHOGTxetfg7FU,619
133
133
  location/providers/zillow.py,sha256=nCV_q_9ULRkgxi4HTZHioP6nWDDmApvSf1DcwNLcOxk,1935
134
134
  location/rpc/__init__.py,sha256=74T2Y3Zw7ZOl_h67Gdb-tfkyKJAJFSDFHjv04FRKsjQ,123
135
- location/rpc/ip.py,sha256=DtFiRNGm9wnNz8Bed2hxANFMcQhfd6BH6v7c89IVx5c,875
135
+ location/rpc/ip.py,sha256=TbRRgh4_hykT_Z0PDQrMnCdp_x0nK0Zm_WnvzXuweF4,1305
136
136
  location/rpc/location.py,sha256=D5R54nnmmp8NaHQRkP_TF921Ej6j9nmTUNzX1K5WVPc,779
137
137
  location/rpc/track.py,sha256=jSS9_eiKayM_8iW_4Ldojg9a2_trjfXhnLe_a261x5E,3735
138
138
  medialib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -350,7 +350,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
350
350
  rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
351
351
  rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
352
352
  rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
353
- rest/__init__.py,sha256=cgJ85yBetTOJGyIg6bbItIkke57c8MfIj9JtbyVyMd0,121
353
+ rest/__init__.py,sha256=yKUhy4QLzfRVHXFOkJ5gTp1ZH-VLHdi4d6I5qBr-PWI,121
354
354
  rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
355
355
  rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
356
356
  rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
@@ -449,7 +449,7 @@ telephony/migrations/0002_alter_sms_sid.py,sha256=QAnMG-UZ5emssZwdJ8XwfaRh3872zU
449
449
  telephony/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
450
450
  telephony/models.py,sha256=C6TTG24FADIWCJJunScvzYyp6t4fYEMuxdUYaN0KfLU,7894
451
451
  telephony/phone_util.py,sha256=aJ4hXjDCauwrSaI_qWa5HVCgD2CCdWx6TA_ikJ6kC7w,2126
452
- telephony/rpc.py,sha256=ni3IaY1o_isTtVQm0gYH2iIP0IbBynaewj4UfkjJK-0,3121
452
+ telephony/rpc.py,sha256=GVPWH5XSPNar-ICu5oq-yF6FBmJbju3XJr6gSXA6ZVU,3535
453
453
  wiki/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
454
454
  wiki/migrations/0001_initial.py,sha256=9jvUyjrbJrbDilRnwzQUPhPV8Xi_olEPBk_N0nycvM0,3606
455
455
  wiki/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -482,7 +482,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
482
482
  ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
483
483
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
484
484
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
485
- django_restit-4.1.71.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
486
- django_restit-4.1.71.dist-info/METADATA,sha256=qUXlqbkRFFIN4HCd07RBEX5UYtWvKvppLP4eFPn5jHY,7573
487
- django_restit-4.1.71.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
488
- django_restit-4.1.71.dist-info/RECORD,,
485
+ django_restit-4.1.72.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
486
+ django_restit-4.1.72.dist-info/METADATA,sha256=ldiAuTSzPz2ky_RTBIK7XqA8oDCa45x_RsvEmIvQtqQ,7573
487
+ django_restit-4.1.72.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
488
+ django_restit-4.1.72.dist-info/RECORD,,
location/models/ip.py CHANGED
@@ -8,6 +8,9 @@ GEOIP_LOOKUP_BY_SUBNET = settings.get("GEOIP_LOOKUP_BY_SUBNET", True)
8
8
 
9
9
 
10
10
  class GeoIP(models.Model, rm.RestModel):
11
+ class RestMeta:
12
+ SEARCH_FIELDS = ["ip", "isp"]
13
+
11
14
  created = models.DateTimeField(auto_now_add=True)
12
15
  modified = models.DateTimeField(auto_now=True)
13
16
  hostname = models.CharField(max_length=255, blank=True, null=True, default=None)
location/rpc/ip.py CHANGED
@@ -25,8 +25,21 @@ def on_ip_lookup(request):
25
25
  return gip.restGet(request, graph)
26
26
 
27
27
 
28
- @rd.url(r'^geo/ip$')
29
- @rd.url(r'^geo/ip/(?P<pk>\d+)$')
28
+ @rd.urlGET('geo/ip')
29
+ @rd.urlGET('geo/ip/<int:pk>')
30
30
  @rd.login_required
31
31
  def rest_on_geoip(request, pk=None):
32
32
  return location.GeoIP.on_rest_request(request, pk)
33
+
34
+
35
+ @rd.urlPOST('geo/ip')
36
+ @rd.login_required
37
+ @rd.requires_params(["ip"])
38
+ def rest_on_geoip_lookup(request, pk=None):
39
+ ip = request.DATA.get("ip", request.ip)
40
+ gip = location.GeoIP.get(
41
+ ip,
42
+ force_refresh=request.DATA.get("refresh", 0, field_type=bool),
43
+ stale_after=request.DATA.get("stale_after", 90, field_type=int))
44
+ graph = request.DATA.get("graph", "default")
45
+ return gip.restGet(request, graph)
rest/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .uberdict import UberDict # noqa: F401
2
2
  from .settings_helper import settings # noqa: F401
3
3
 
4
- __version__ = "4.1.71"
4
+ __version__ = "4.1.72"
telephony/rpc.py CHANGED
@@ -22,6 +22,24 @@ def handle_sms_list(request, pk=None):
22
22
  return SMS.on_rest_request(request, pk)
23
23
 
24
24
 
25
+ @rd.urlGET('info')
26
+ @rd.urlGET('info/<int:pk>')
27
+ @rd.perm_required("view_logs")
28
+ def handle_number_info(request, pk=None):
29
+ return PhonenumberInfo.on_rest_request(request, pk)
30
+
31
+
32
+ @rd.urlPOST('info')
33
+ @rd.login_required
34
+ @rd.requires_params(["phone_number"])
35
+ def handle_number_lookup(request, pk=None):
36
+ number = request.DATA.get("phone_number")
37
+ info = PhonenumberInfo.lookup(number)
38
+ if info.pk is None:
39
+ return rv.restStatus(request, False, error="Invalid number")
40
+ return info.restGet(request)
41
+
42
+
25
43
  @rd.urlPOST(r'^sms$')
26
44
  @rd.urlPOST(r'^sms/$')
27
45
  @rd.login_required
@@ -67,13 +85,6 @@ def receiveSMS(request):
67
85
  return HttpResponse(resp.to_xml(), content_type='text/xml')
68
86
 
69
87
 
70
- @rd.url(r'^info$')
71
- @rd.url(r'^info/(?P<pk>\d+)$')
72
- @rd.login_required
73
- def handle_info(request, pk=None):
74
- return PhonenumberInfo.on_rest_request(request, pk)
75
-
76
-
77
88
  @rd.url(r'^lookup$')
78
89
  @rd.login_required
79
90
  def handle_lookup(request, pk=None):
@@ -92,6 +103,7 @@ def handle_twilio_status(request, pk=None):
92
103
  msg = SMS.objects.filter(sid=sid).last()
93
104
  if msg is not None:
94
105
  msg.status = request.DATA.get("MessageStatus", None)
106
+ msg.reason = request.DATA.get("ErrorCode", None)
95
107
  msg.save()
96
108
  return rv.restSuccessNoContent(request)
97
109