Skip to content
Advertisement

Tag: json

Python3: JSON POST Request WITHOUT requests library

I want to send JSON encoded data to a server using only native Python libraries. I love requests but I simply can’t use it because I can’t use it on the machine which runs the script. I need to do it without. My server is a local WAMP server. I always get an urllib.error.HTTPError: HTTP Error 500: Internal Server Error

How to get sorted list inside a dictionary with json.dumps()

I have the following problem: having a python dictionary like the following: I would like to obtain an ordered json object such as: At the moment I use the following: But the two list inside my object are not sorted, and I get: probably because the custom JSONEncoder skips a type that already knows how to manage (list). UPDATE Martijn

django, “is not JSON serializable” when using ugettext_lazy?

I have this in my views.py Since I start using this import: from django.utils.translation import ugettext_lazy as _ at this line: message = _(‘This is a test message’) I get this error: Why? What am I doing wrong? Answer You can also create you own JSON encoder that will force __proxy__ to unicode. From https://docs.djangoproject.com/en/1.8/topics/serialization/ So now your code can

how to delete json object using python?

I am using python to delete and update a JSON file generated from the data provided by user, so that only few items should be stored in the database. I want to delete a particular object from the JSON file. My JSON file is: I want to delete the JSON object with ename mark. As I am new to python

Advertisement