Login

Tag "piston"

Snippet List

django piston use origin django auth

Django-piston have two build-in authentication handlers, the HttpBasicAuthentication and OAuthAuthentication. This snippet give another choice which use the django auth. It can support ajax and normal request.

  • django
  • auth
  • piston
Read More

Comparing two json like python objects

Shows difference between two json like python objects. May help to test json response, piston API powered sites... Shows properties, values from first object that are not in the second. Example: import simplejson # or other json serializer first = simplejson.loads('{"first_name": "Poligraph", "last_name": "Sharikov",}') second = simplejson.loads('{"first_name": "Poligraphovich", "pet_name": "Sharik"}') df = Diff(first, second) df.difference is ["path: last_name"] Diff(first, second, vice_versa=True) gives you difference from both objects in the one result. df.difference is ["path: last_name", "path: pet_name"] Diff(first, second, with_values=True) gives you difference of the values strings.

  • django
  • json
  • piston
  • compare
Read More

6 snippets posted so far.