Tagged Questions
0
votes
0answers
11 views
Python Client sending JSON via REST to Java server
Trying to send a json data using a PUT method to a Java server testing locally
How do I print out the JSON data on the server side?
also, python client seems to have an error: ...
0
votes
1answer
11 views
Google Trends API not good json when read into python
Using HTTP requests in Pthon I was able to get a response, however neither json nor simplejson modules are able to unpackage it. Both claim that the input is not good json.
import requests
import ...
-2
votes
2answers
36 views
Save file without first and last double quotes
I am trying to save my data to a file. My problem is the file i saved contains double quotes at the first and the last of a line. I have tried many ways to solve it from str.replace(), strip, csv to ...
0
votes
1answer
21 views
How do I convert Python POST data to JSON?
I have the following code in Python:
def post(self):
example = self.request.get("example")
other = self.request.get("other")
How do I get all post data if unknown? I'm very new to Python ...
0
votes
1answer
18 views
throws an error while saving from json file having the twitter data into csv file, python
I have json file which has the meta data of twitter data. I want to extract date, tweet, user, location of that tweet and save it into a csv file. I get the error "No JSON object could be decoded
...
1
vote
3answers
45 views
How can I find out why an object can't be JSON serialized?
I have a very simple use case of data that I wish to serialize to JSON, but I keep getting tripped by error TypeError: <api.tests.MemberInfo object at 0x02B26210> is not JSON serializable
Here ...
2
votes
3answers
27 views
Read json file from python
I am trying to read json file from python script using the json library. After some googling I found the following code:
with open(json_folder+json) as json_file:
json_data = ...
0
votes
2answers
30 views
Getting JSON info in python
Sample of the database:
"metros" : [
{
"code" : "SCL" ,
"name" : "Santiago" ,
"country" : "CL" ,
"continent" : "South America" ,
...
1
vote
1answer
39 views
Parsing an ad-hoc tree
I have a flat file that appears as follows:
Soccer
+Team:US
++Shirt:Red & White Stripes
++Shorts:Blue
++Players:17
+++Active:11
++++Forward:2
++++Midfield:4
++++Defense:4
++++Goalkeeper:1
...
-1
votes
0answers
49 views
[[ jQuery ]] How can I send and get JSON data? [[ Django ]]
I would like to combine Django with jQuery.
models.py:
from django.db import models
class nikkeihyou(models.Model):
taishaku = models.PositiveSmallIntegerField()
kamoku = ...
0
votes
0answers
22 views
Python/Flask - What is the better approach to cache external API data? [on hold]
I'm developing an application that makes a request to an external API, and uses json data received to work. I don't need this data updated frequently, once a day is more than sufficient to me.
I'm ...
0
votes
2answers
21 views
Access array based on number of named key
json_data = {"fruits": ["apple", "banana", "orange"],"vegetables":["tomatoe", "cucumber", "potato"]}
How do I access my array numerically without having to include a numeric key?
ex:
...
0
votes
0answers
24 views
Problems with upload Content [on hold]
I try to do a Python program to generate shows and download video's from web.photodex.com
root_url = 'http://web.photodex.com/signin'
ops_url = 'Wrong username'
ans1 = '\n'+'================'+'\n'
...
0
votes
0answers
25 views
Why I can't configure OAuth 2.0 using Python?
I was trying to get my uploading YouTube video software to work using this guide/code:
https://developers.google.com/youtube/v3/guides/uploading_a_video
I installed & setup everything that is ...
0
votes
1answer
22 views
Flask jsonify returns weird array?
I'm trying to create a simple API using Flask. I now want to return a list of dicts as follows:
print results # prints out [{'date': '2014-09-25 19:00:00', 'title': u'Some Title'}]
response = ...
0
votes
1answer
47 views
Passing multiple value_list in Django
I have this code in views.py:
def pins_info(request):
if request.method == "GET":
getpin = request.GET.get('pin', None)
m = ButuanMaps.objects.filter(clandpin=getpin).
...
0
votes
0answers
12 views
Using the Twitter API to get a real-time feed of tweets
I am doing an analytics project in which I require a real-time feed of tweets (not specific to a timeline, but globally within Twitter) based on a search criteria. I am new to the Twitter API and was ...
1
vote
1answer
22 views
Flask JSON serializable error because of flask babel
I am using https://pythonhosted.org/Flask-Babel/ extention for localization.
base form class
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from app import app
from flask.ext.wtf import Form
class ...
1
vote
1answer
25 views
Accessing Json data through api with Python
I'm trying to access the Atlas Observatory of Economic Complexity API at this location:
http://atlas.media.mit.edu/about/api/data/
Using the following code
import pandas as pd
import numpy as np
...
1
vote
0answers
31 views
Cannot write dictionary to json file. Possibly too large? [on hold]
I have a pretty big array of text-data. It only has a thousand elements (each element is a dictionary with 5 keys each), but ipython takes a couple of seconds to even print it. I am now putting this ...
1
vote
0answers
25 views
How to do transaction concurrency control when use json file as database? [on hold]
I am implementing a small application. So for easy deployment I choose to use json as a "database". Each json file will have data like a "table".
However, I am not sure how people usually deal with ...
0
votes
1answer
21 views
output every attribute, value in an uneven JSON object
I have a very long and uneven JSON object and I want to output every attribute, value for the end points (leaves) of the object.
For instance, it could look like this:
data = {
"Response": {
...
-1
votes
0answers
18 views
Encoding ASCII Python [duplicate]
I got a problem of encoding string.
I am doing:
json_string = json.dumps([[cre.__dict__ for cre in lst] for lst in part1])
And the output of json_string is :
Cr\u00e8che familiale \u00e0 Bastia
...
0
votes
2answers
32 views
JSON like string with unicode to valid JSON
I get a string which resembles JSON and I'm trying to convert it to valid JSON using python.
It looks like this example, but the real data gets very long:
{u'key':[{
u'key':u'object',
...
0
votes
1answer
23 views
How do I extract the dictionary from a JSON file to a pandas Dataframe?
I've extracted the data into a JSON file (it is a nest filed)
I've read_json to extract the data into a pandas:
df = pd.read_json('./data0000.json')
but got this as the data is nested ( all the ...
0
votes
1answer
68 views
Structuring Plain Text to JSON
I am attempting to take a collection of strings, tokenize the strings
into individual characters, and restructure them into JSON for the purpose of
building a cluster dendrogram visualization (sort ...
-1
votes
0answers
15 views
How do I extract json contents to a panda data frame?
I have json files that I'm trying to extract the data out of.
Currently I'm doing:
with open('./data0.json') as f:
data = pd.DataFrame(json.loads(line) for line in f)
But this returns me a ...
-2
votes
1answer
31 views
Django returned JSON, how to parse JSON Objects in js
I am returning from my django code JSON and it looks like this:
my django code:
objs = AccessInfo.objects.filter(~Q(weblink=''))
return HttpResponse(serializers.serialize('json', objs), ...
0
votes
1answer
40 views
google app engine python as backend and angular js as frontend for mobile web
I m trying to implement end to end data sharing between GAE via python and angularJS mobile app using JSON as request body from mobile with contentType as application/json.
I can see in my log that ...
0
votes
1answer
37 views
How to change dataypes when encoding JSON in Python
Dealing with a semi JSON API of google that returns everything as a string - even numeric elements.
// [
{
"id": "22144"
,"t" : "AAPL"
,"e" : "NASDAQ"
,"l" : "100.75"
...
0
votes
2answers
64 views
Writing massive dictionary to file in python
I'm writing a huge dictionary to disk - its handled in memory just fine, but when I output it, I get an error related to the fact that the json written is not complete. How can I write out or stream ...
0
votes
1answer
28 views
Python - JSON Load from file not working
So I am writing a basic multipurpose script which uses json to import a dictionary from a file but for some reason it doesn't save properly. I've looked all over and can't find anything relating to my ...
1
vote
2answers
25 views
flask - how to get parameters from a JSON GET request
I have a client side api that issues the following GET request:
"GET ...
0
votes
1answer
24 views
Use Json data to initialize an object in python?
Here is what I got right now.
import urllib2
import json
from pprint import pprint
response = ...
1
vote
1answer
37 views
How to pass model fields to a JsonResponse object
Django 1.7 introduced the JsonResponse objects, which I try to use to return a list of values to my ajax request.
I want to pass
>>> Genre.objects.values('name', 'color')
[{'color': ...
-1
votes
1answer
32 views
str to dict in python, but maintain the sequence of json attributes
I've tried ast.literal_eval and json.loads but both of these, doesn't maintain the sequence of json attributes when a string is provided. Please see the following example -
String before providing it ...
1
vote
1answer
24 views
converting json response from web service to dictionary or object in python
I have a small python section of code -
self.drive_service = build('drive', 'v2', http=self.http)
result = self.retrieve_all_files(self.drive_service)
print "result recieved \n"
rootNode = ...
0
votes
0answers
20 views
pool.map() from python multiprocessing library causes JSON error
I'm using the multiprocessing library, which makes it very difficult to debug an error when it occurs. Simple code structure:
import multiprocessing
from multiprocessing import Pool
import traceback
...
2
votes
1answer
22 views
Sending POST request to AJAX with Python3.4 and urllib
I am trying to scrape line movements from: http://scores.covers.com/football-scores-matchups.aspx
I need to iterate through each Season and Week of using the Calendar provided:
When I inspect the ...
0
votes
1answer
25 views
Make a dictionary from parsed data python
I have this code right here that parses som information from the web:
import lxml.html
from lxml.etree import XPath
import json
url = "http://gbgfotboll.se/information/?scr=table&ftid=51168"
...
-1
votes
0answers
32 views
Python JSON Data Structure
I have this code:
response = requests.get('https://xxx.vendhq.com/api/customers', auth=('xxx', 'yyy'))
data = response.json()
customer_groups = [customer['customer_group_name'] for customer in ...
0
votes
0answers
24 views
How to export raw data feeds from Google Big Query to R servers in a CSV tabular format?
I tried using the Python code mentioned in the link https://cloud.google.com/bigquery/exporting-data-from-bigquery
However, on running the code it says that since the table has a nested schema it ...
0
votes
1answer
22 views
How do I parse twitter User object returned by the followers call to the api?
I have tried to find information about the structure of the Twitter object returned by, for example, Tweepy api.followers. Upon a cursory look, I thought it was json, but it is not. It starts with ...
0
votes
1answer
37 views
Python Appengine initialize ndb model object with JSON
I've seen countless of examples on how to encode an ndb.Model object using to_dict() and json.dumps() to a json, but couldn't find one working example on how to do the opposite: decoding the result of ...
0
votes
0answers
18 views
Can not instantiate value of type[simple type], (through reference chain Object[][0] appears when invoked an rest API via python
I searched the other related questions, but no solution seems to be working.
I'm invoking the rest API via python.
Python code invoking the rest API is as follows -
s = Session()
...
-1
votes
1answer
23 views
List of lists of objects to JSON with Python
I have a List with multi lists of objects:
ob = Obj()
for p in l:
list_url_commune = scrapingCities(base_url, p)
for u in list_url_commune:
list_name = scaping_creches(base_url, u, ...
-2
votes
1answer
24 views
List of objects to JSON with Python
I have a problem converting Object instances to JSON:
ob = Object()
list_name = scaping_myObj(base_url, u, number_page)
for ob in list_name:
json_string = json.dumps(ob.__dict__)
print ...
0
votes
0answers
30 views
Python JSON Vend API definition
I have this code:
response = requests.get('https://xxx.vendhq.com/api/customers',
auth=('xxx', 'yyy'))
data = response.json()
customer_groups = [customer['customer_group_name'] ...
0
votes
2answers
35 views
Trouble with JSON and the Twitter API
So, i'm running into this problem while trying to request statuses from my feed and the error is so vague I can't figure out what I'm doing wrong. Any help would be appreciated.
My Code:
with ...
0
votes
0answers
9 views
VBA XMLHTTP query returning 403 error
I am currently attempting to retrieve a json string using XMLHTTP in VBA from the website url detailed below. Loading the first url creates a session, which I retrieve from the HTML body. A call to ...