JSON serialization Error in Python 3.2 -


i using json library , trying import page feed csv file. tried many ways result every time code execute gives json not serialzable. no facebook use auth code have , used connection string change if use page has public privacy still able result below code.

following code

import urllib3 import json import requests #from pprint import pprint import csv urllib.request import urlopen  page_id = "abcd" # username or id api_endpoint = "https://graph.facebook.com" fb_graph_url = api_endpoint+"/"+page_id try: #api_request = urllib3.requests(fb_graph_url)     #http = urllib3.poolmanager()     #api_response = http.request('get', fb_graph_url)     api_response = requests.get(fb_graph_url)     try:         #print (list.sort(json.loads(api_response.read())))         obj = open('data', 'w')         #    write(json_dat)         f = api_response.content          obj.write(json.dumps(f))         obj.close()     except exception ee:         print(ee) except exception e:     print( e) 

tried many approach not successful. hope 1 can help

requests.get(fb_graph_url).content 

is string. using json.dumps on won't work. function expects list or dictionary argument.

if request returns json, write file.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -