How to use the jsonlib.loads function in jsonlib

To help you get started, we’ve selected a few jsonlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pythonanywhere / dirigible-spreadsheet / python / dirigible / sheet / calculate.py View on Github external
def api_json_to_worksheet(sheet_json):
    sheet_values = jsonlib.loads(sheet_json)
    worksheet = Worksheet()

    worksheet.name = sheet_values.get('name', 'Untitled')
    for key, value in sheet_values.iteritems():
        if key == "usercode_error":
            worksheet._usercode_error = value
        elif isinstance(value, dict):
            rows = value
            col = int(key)
            for row, value in rows.iteritems():
                row = int(row)
                worksheet[col, row].value = value
    return worksheet
github nzjrs / facebook-notify / libfacebooknotify / facebook / __init__.py View on Github external
def _parse_response(self, response, method, format=None):
        """Parses the response according to the given (optional) format, which should be either 'JSON' or 'XML'."""
        if not format:
            format = RESPONSE_FORMAT

        if format == 'JSON':
            result = simplejson.loads(response)

            self._check_error(result)
        elif format == 'XML':
            dom = minidom.parseString(response)
            result = self._parse_response_item(dom)
            dom.unlink()

            if 'error_response' in result:
                self._check_error(result['error_response'])

            result = result[method[9:].replace('.', '_') + '_response']
        else:
            raise RuntimeError('Invalid format specified.')

        return result
github antlong / picka / picka / albanian.py View on Github external
# -*- coding: UTF-8 -*-
"""
Picka is a data generation and randomization module which aims to increase
coverage by increasing the amount of tests you _dont_ have to write
by hand.
By: Anthony Long
"""
import os
import random
import string
import jsonlib as json
__docformat__ = "restructuredtext en"
albanian_names = json.loads(open(os.path.join(os.path.dirname(__file__), 'albanian.json')).read())['albanian']


def age(min=1, max=99):
    return random.randint(min, max + 1)


def apartment_number():
    return ' '.join([random.choice(["apartament", "pas", "dhomë"]), str(random.randint(1, 100))])


def business_title():
    pass


def calling_code():
    pass
github HubSpot / hapipy / hapi / pyspot.py View on Github external
def _prepare_response(self, code, data):
        msg = self._get_msg(code)
        if data:
            try:
                data = simplejson.loads(data)
            except ValueError:  
                pass
        return {'status': code, 'body': data or {}, 'msg': msg}
github chuchiperriman / cloud-services-notifications / src / cloudsn / providers / facebook / __init__.py View on Github external
def _parse_response(self, response, method, format=None):
        """Parses the response according to the given (optional) format, which should be either 'JSON' or 'XML'."""
        if not format:
            format = RESPONSE_FORMAT

        if format == 'JSON':
            result = simplejson.loads(response)
            print 'result: ', result
            self._check_error(result)
        elif format == 'XML':
            dom = minidom.parseString(response)
            result = self._parse_response_item(dom)
            dom.unlink()

            if 'error_response' in result:
                self._check_error(result['error_response'])

            result = result[method[9:].replace('.', '_') + '_response']
        else:
            raise RuntimeError('Invalid format specified.')

        return result
github Kegbot / kegbot-server / pykeg / src / pykeg / external / facebook / __init__.py View on Github external
def _parse_response(self, response, method, format=None):
        """Parses the response according to the given (optional) format, which should be either 'JSON' or 'XML'."""
        if not format:
            format = RESPONSE_FORMAT

        if format == 'JSON':
            result = simplejson.loads(response)

            self._check_error(result)
        elif format == 'XML':
            dom = minidom.parseString(response)
            result = self._parse_response_item(dom)
            dom.unlink()

            if 'error_response' in result:
                self._check_error(result['error_response'])

            result = result[method[9:].replace('.', '_') + '_response']
        else:
            raise RuntimeError('Invalid format specified.')

        return result

jsonlib

JSON serializer/deserializer for Python

GPL-3.0
Latest version published 15 years ago

Package Health Score

43 / 100
Full package analysis

Similar packages