communication.py 384 Bytes
Newer Older
Burak Kelgin's avatar
Burak Kelgin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import json
from django.core.management.base import BaseCommand
from polls.models import servers, count

#x is bytes output
def myparser(x):
    res=x.content
    print(x.content)
    print(type(x.content))
    parsed= res.decode()  #convert to string
    print(type(parsed))
    decoded = json.loads(parsed)
    print(json.dumps(decoded, sort_keys=True, indent=4))
    return decoded