Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50801

Re: [ANN]:JSONStream

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <fabiosantosart@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.04; 'api.': 0.05; 'json': 0.07; 'subject:ANN': 0.07; 'obj': 0.09; 'objects:': 0.09; 'cc:addr:python-list': 0.11; '&gt;&gt;': 0.16; 'cc:name:python list': 0.16; 'clark': 0.16; 'dashes': 0.16; 'skip:j 60': 0.16; 'yaml': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '8bit%:5': 0.22; '>>>': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; '&gt;&gt;&gt;': 0.24; 'processor': 0.24; 'skip:{ 20': 0.24; 'looks': 0.24; '---': 0.24; 'cc:2**0': 0.24; '&gt;': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'doc': 0.31; 'feeds': 0.31; 'third': 0.33; 'could': 0.34; 'objects': 0.35; 'received:google.com': 0.35; 'add': 0.35; "didn't": 0.36; 'method': 0.36; 'useful': 0.36; 'skip:& 10': 0.38; 'handle': 0.38; 'skip:& 20': 0.39; 'space': 0.40; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'useful.': 0.68; 'jul': 0.74; 'processor.': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+2YhozZ7vQJ5HAPY+Tz8sMhX+lQL+AuacZT6V71wHjk=; b=D5kCxKg7nVnPLGILLe/n8yOXStNaNB9jERXig/1R1+Ao/KsaKaAzSpkrfHOX+8rd2w 1k5FPU/5ozjR9gMyi4A+dF3uW+DX3sDg55vMLB+XvF270UpyazkALDtOyWQaB7Tn4wk7 7lLiCKwkBrJX//ueyWup6CpUlI8V2FyzehOOno9B9weKThS83k3wHcMgYOYIBia1inUy TkdhKaKu4kmp+RNie58y9cVmdzF+VVUfn1ktoeLez4FzhRPktKYOL7MunFtkUwwYr7LH aeRlUj9sY4eAZ3j7TQKsImb1e2m7IpkYnEEQcdwcMXBrhKey4eeiNzf4Lr+EqdaNDKlz O7rg==
MIME-Version 1.0
X-Received by 10.224.123.68 with SMTP id o4mr10368376qar.106.1374090307135; Wed, 17 Jul 2013 12:45:07 -0700 (PDT)
In-Reply-To <CACGSewcX15=dRsEZkdaPbe71dff5XS5ENVR-+6SiRJ0+E4iLqQ@mail.gmail.com>
References <CACGSewf0J3SPNssM-iJPg1Rthj+_wJe1p-fGe4_FcgxHGiJu0A@mail.gmail.com> <1374076300.20300.140661256765729.2467B0A8@webmail.messagingengine.com> <CACGSewcX15=dRsEZkdaPbe71dff5XS5ENVR-+6SiRJ0+E4iLqQ@mail.gmail.com>
Date Wed, 17 Jul 2013 20:45:07 +0100
Subject Re: [ANN]:JSONStream
From Fábio Santos <fabiosantosart@gmail.com>
To Sol Toure <sol2ray@gmail.com>
Content-Type multipart/alternative; boundary=047d7bd6bc92a56d9704e1ba5461
Cc Python List <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4811.1374090316.3114.python-list@python.org> (permalink)
Lines 103
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374090316 news.xs4all.nl 15924 [2001:888:2000:d::a6]:48097
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50801

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 17 Jul 2013 20:40, "Sol Toure" <sol2ray@gmail.com> wrote:
>
> I didn't look into using YAML processor.
> Also that would have required pre-processing the data to add the
separators.
> With this method you don't need the separators. You can have 0 or more
white space between objects:
>
> for obj in JSONStream(StringIO('''{"one":1}{"two":2}    {"three":3} 4
{"five": 5}''')):
>   print(obj)
>
> {"one":1}
> {"two":2}
> {"three":3}
> 4
> {"five":5}
>
> It solved my problem, so I thought someone might find it useful.
>
>
>
> On Wed, Jul 17, 2013 at 11:51 AM, Clark C. Evans <cce@clarkevans.com>
wrote:
>>
>> Looks interesting.  In YAML we used three dashes as the "stream
separator".
>> So already a YAML processor could handle a JSON stream ...
>>
>> >>> for doc in yaml.load_all("""
>> ... --- {"one": "value"}
>> ... --- {"two": "another"}
>> ... ---
>> ... {"three": "a third item in the stream",
>> ...  "with": "more data"}
>> ... """):
>> ...     print doc
>> ...
>> {'one': 'value'}
>> {'two': 'another'}
>> {'with': 'more data', 'three': 'a third item in the stream'}

I think this could be useful for the twitter stream api. It feeds
\n-separated json objects over time.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [ANN]:JSONStream Fábio Santos <fabiosantosart@gmail.com> - 2013-07-17 20:45 +0100

csiph-web