Forum
>>
Principianti
>>
JSON
Pagina: 1
Esegui il login per scrivere una risposta.
Pagina: 1
Scritto da khan |
2015-09-20 16:07:26 - JSON
|
{
"meta": { "status": 200, "msg": "OK" }, "response": { "posts": [ { "blog_name": "x", "id": x, "post_url": "x", "slug": "", "type": "x", "date": "x", "timestamp": x, "state": "x", "format": "x", "reblog_key": "x", "tags": [ "x", "x", "x", "x", "x", "x" ], "short_url": "x", "recommended_source": null, "recommended_color": null, "recommendation_reason": null, "followed": true, "highlighted": [], "liked": false, "note_count": x, "source_url": "x", "source_title": "x", "caption": "", "reblog": { "tree_html": "", "comment": "" }, "trail": [], "link_url": "x", "image_permalink": "x", "photos": [ { "caption": "", "alt_sizes": [ { "url": "x", "width": x, "height": x }, { "url": "x", "width": x, "height": x }, { "url": "x", "width": x, "height": x }, { "url": "x", "width": x, "height": x }, { "url": "x", "width": x, "height": x } ], "original_size": { "url": "x", "width": x, "height": x } } ], "reblogged_from_id": "x", "reblogged_from_url": "x", "reblogged_from_name": "x", "reblogged_from_title": "x", "reblogged_from_following": false, "reblogged_root_id": "x", "reblogged_root_url": "x", "reblogged_root_name": "x", "reblogged_root_title": "x", "reblogged_root_following": false, "can_reply": false }, { "blog_name": "x", "id": x, "post_url": "x", "slug": "x", "type": "photo", "date": "x", "timestamp": x, "state": "x", "format": "x", "reblog_key": "x", "tags": [ "x", "x", "x", "x", "x" ], "short_url": "x", "recommended_source": null, "recommended_color": null, "recommendation_reason": null, "followed": true, "highlighted": [], "liked": false, "note_count": x, "caption": "x", "reblog": { "tree_html": "", "comment": "x" }, "trail": [ { "blog": { "name": "x", "active": true, "theme": { "avatar_shape": "x", "background_color": "x", "body_font": "x", "header_bounds": x, "header_image": "x", "header_image_focused": "x", "header_image_scaled": "x", "header_stretch": true, "link_color": "x", "show_avatar": true, "show_description": true, "show_header_image": true, "show_title": true, "title_color": "x", "title_font": "x", "title_font_weight": "x" } }, "post": { "id": x }, "content_raw": "x", "content": "x", "is_current_item": true, "is_root_item": true } ], "image_permalink": "x", "photos": [ { "caption": "", "alt_sizes": [ { "url": "x", "width": x, "height": x }, { "url": "x", "width": x, "height": x }, { "url": "x", "width": x, "height": x }, { "url": "x", "width": x, "height": x }, { "url": "x", "width": x, "height": x } ], "original_size": { "url": "x", "width": x, "height": x } } ], "can_reply": false } ] } }codice: a=client.dashboard(limit=limite,type='photo', reblog_info=True) print (a) # output: {u'posts': [{u'liked': False, u'followed': True, u'reblo... data=json.dumps(a) node=data ["response"]["posts"]["blog_name"] print (str(node))errore:Traceback (most recent call last): line 20, in <module> node=data ["response"]["posts"]["blog_name"] TypeError: string indices must be integers, not str OBIETTIVO:-BLOG NAME-ID -REBLOG_KEY -TAGS |
|
Scritto da Daniele aka Palmux |
2015-09-20 16:19:49 - Re: JSON
|
L'errore è autoesplicativo, comunque ti consiglio la lettura di questa sezione della documentazione, ovviamente scegliendo la versione che utilizzi.
Cya |
|
Scritto da khan |
2015-09-20 16:27:29 - Re: JSON
|
RISOLTO GRAZIE
cosa è un errore autoesplicativo? Scusa l'ignoranza --- Ultima modifica di khan in data 2015-09-20 16:47:31 --- |
Pagina: 1
Esegui il login per scrivere una risposta.