Tag: json

Ändern Sie Scrapy JSON Output

Ich arbeite mit Scrapy, um JSON von meiner Spinne in der Pipeline zu exportieren. Ich möchte den Json in ein Produktobjekt einpacken. Ich benutze den JsonLinesItemExporter Derzeit sieht mein JSON so aus: {"name": "Protective iPhone Stand Case", "link": "https://things.com/899029978367138670/Strap-On-SoftRack-Roof-Rack-by-Otium", "category_old": "Sports & Outdoors", "image_url": "https://thingd-media-ec1.com/default/899029978367138670_42120cf10765.jpg", "price": "160", "interest": "13", "company": "ACME", "country": "USA"} "product": { […]

Pandas: Hol dir json aus Datenrahmen

Ich habe Datenrahmen member_id,2015-05-01,2015-05-02,2015-05-03,2015-05-04,2015-05-05,2015-05-06,2015-05-07,2015-05-08,2015-05-09,2015-05-10,2015-05-11,2015-05-12,2015-05-13,2015-05-14,2015-05-15,2015-05-16,2015-05-17,2015-05-18,2015-05-19,2015-05-20,2015-05-21,2015-05-22,2015-05-23,2015-05-24,2015-05-25,2015-05-26,2015-05-27,2015-05-28,2015-05-29,2015-05-30,2015-05-31,2015-06-01,2015-06-02,2015-06-03,2015-06-04,2015-06-05,2015-06-06,2015-06-07,2015-06-08,2015-06-09,2015-06-10,2015-06-11,2015-06-12,2015-06-13,2015-06-14,2015-06-15,2015-06-16,2015-06-17,2015-06-18,2015-06-19,2015-06-20,2015-06-21,2015-06-22,2015-06-23,2015-06-24,2015-06-25,2015-06-26,2015-06-27,2015-06-28,2015-06-29,2015-06-30,2015-07-01,2015-07-02,2015-07-03,2015-07-04,2015-07-05,2015-07-06,2015-07-07,2015-07-08,2015-07-09,2015-07-10,2015-07-11,2015-07-12,2015-07-13,2015-07-14,2015-07-15,2015-07-16,2015-07-17,2015-07-18,2015-07-19,2015-07-20,2015-07-21,2015-07-22,2015-07-23,2015-07-24,2015-07-25,2015-07-26,2015-07-27,2015-07-28,2015-07-29,2015-07-30,2015-07-31,2015-08-01,2015-08-02,2015-08-03,2015-08-04,2015-08-05,2015-08-06,2015-08-07,2015-08-08,2015-08-09,2015-08-10,2015-08-11,2015-08-12,2015-08-13,2015-08-14,2015-08-15,2015-08-16,2015-08-17,2015-08-18,2015-08-19,2015-08-20,2015-08-21,2015-08-22,2015-08-23,2015-08-24,2015-08-25,2015-08-26,2015-08-27,2015-08-28,2015-08-29,2015-08-30,2015-08-31,2015-09-01,2015-09-02,2015-09-03,2015-09-04,2015-09-05,2015-09-06,2015-09-07,2015-09-08,2015-09-09,2015-09-10,2015-09-11,2015-09-12,2015-09-13,2015-09-14,2015-09-15,2015-09-16,2015-09-17,2015-09-18,2015-09-19,2015-09-20,2015-09-21,2015-09-22,2015-09-23,2015-09-24,2015-09-25,2015-09-26,2015-09-27,2015-09-28,2015-09-29,2015-09-30,2015-10-01,2015-10-02,2015-10-03,2015-10-04,2015-10-05,2015-10-06,2015-10-07,2015-10-08,2015-10-09,2015-10-10,2015-10-11,2015-10-12,2015-10-13,2015-10-14,2015-10-15,2015-10-16,2015-10-17,2015-10-18,2015-10-19,2015-10-20,2015-10-21,2015-10-22,2015-10-23,2015-10-24,2015-10-25,2015-10-26,2015-10-27,2015-10-28,2015-10-29,2015-10-30,2015-10-31,2015-11-01,2015-11-02,2015-11-03,2015-11-04,2015-11-05,2015-11-06,2015-11-07,2015-11-08,2015-11-09,2015-11-10,2015-11-11,2015-11-12,2015-11-13,2015-11-14,2015-11-15,2015-11-16,2015-11-17,2015-11-18,2015-11-19,2015-11-20,2015-11-21,2015-11-22,2015-11-23,2015-11-24,2015-11-25,2015-11-26,2015-11-27,2015-11-28,2015-11-29,2015-11-30,2015-12-01,2015-12-02,2015-12-03,2015-12-04,2015-12-05,2015-12-06,2015-12-07,2015-12-08,2015-12-09,2015-12-10,2015-12-11,2015-12-12,2015-12-13,2015-12-14,2015-12-15,2015-12-16,2015-12-17,2015-12-18,2015-12-19,2015-12-20,2015-12-21,2015-12-22,2015-12-23,2015-12-24,2015-12-25,2015-12-26,2015-12-27,2015-12-28,2015-12-29,2015-12-30,2015-12-31,2016-01-01,2016-01-02,2016-01-03,2016-01-04,2016-01-05,2016-01-06,2016-01-07,2016-01-08,2016-01-09,2016-01-10,2016-01-11,2016-01-12,2016-01-13,2016-01-14,2016-01-15,2016-01-16,2016-01-17,2016-01-18,2016-01-19,2016-01-20,2016-01-21,2016-01-22,2016-01-23,2016-01-24,2016-01-25,2016-01-26,2016-01-27,2016-01-28,2016-01-29,2016-01-30,2016-01-31,2016-02-01,2016-02-02,2016-02-03,2016-02-04,2016-02-05,2016-02-06,2016-02-07,2016-02-08,2016-02-09,2016-02-10,2016-02-11,2016-02-12,2016-02-13,2016-02-14,2016-02-15,2016-02-16,2016-02-17,2016-02-18,2016-02-19,2016-02-20,2016-02-21,2016-02-22,2016-02-23,2016-02-24,2016-02-25,2016-02-26,2016-02-27,2016-02-28,2016-02-29,2016-03-01,2016-03-02,2016-03-03,2016-03-04,2016-03-05,2016-03-06,2016-03-07,2016-03-08,2016-03-09,2016-03-10,2016-03-11,2016-03-12,2016-03-13,2016-03-14,2016-03-15,2016-03-16,2016-03-17,2016-03-18,2016-03-19,2016-03-20,2016-03-21,2016-03-22,2016-03-23,2016-03-24,2016-03-25,2016-03-26,2016-03-27,2016-03-28,2016-03-29,2016-03-30,2016-03-31,2016-04-01,2016-04-02,2016-04-03,2016-04-04,2016-04-05,2016-04-06,2016-04-07,2016-04-08,2016-04-09,2016-04-10,2016-04-11,2016-04-12,2016-04-13,2016-04-14,2016-04-15,2016-04-16,2016-04-17,2016-04-18,2016-04-19,2016-04-20,2016-04-21,2016-04-22,2016-04-23,2016-04-24,2016-04-25,2016-04-26,2016-04-27,2016-04-28,2016-04-29,2016-04-30,2016-05-01,2016-05-02,2016-05-03,2016-05-04,2016-05-05,2016-05-06,2016-05-07,2016-05-08,2016-05-09,2016-05-10,2016-05-11,2016-05-12,2016-05-13,2016-05-14,2016-05-15,2016-05-16,2016-05-17,2016-05-18,2016-05-19,2016-05-20,2016-05-21,2016-05-22,2016-05-23,2016-05-24,2016-05-25,2016-05-26,2016-05-27,2016-05-28,2016-05-29,2016-05-30,2016-05-31,2016-06-01,2016-06-02,2016-06-03,2016-06-04,2016-06-05,2016-06-06,2016-06-07,2016-06-08,2016-06-09,2016-06-10,2016-06-11,2016-06-12,2016-06-13,2016-06-14,2016-06-15,2016-06-16,2016-06-17,2016-06-18,2016-06-19,2016-06-20,2016-06-21,2016-06-22,2016-06-23,2016-06-24,2016-06-25,2016-06-26,2016-06-27,2016-06-28,2016-06-29,2016-06-30,2016-07-01,2016-07-02,2016-07-03,2016-07-04,2016-07-05,2016-07-06,2016-07-07,2016-07-08,2016-07-09,2016-07-10,2016-07-11,2016-07-12,2016-07-13,2016-07-14,2016-07-15,2016-07-16,2016-07-17,2016-07-18,2016-07-19,2016-07-20,2016-07-21,2016-07-22,2016-07-23,2016-07-24,2016-07-25,2016-07-26,2016-07-27,2016-07-28,2016-07-29,2016-07-30,2016-07-31,2016-08-01,2016-08-02,2016-08-03,2016-08-04,2016-08-05,2016-08-06,2016-08-07,2016-08-08,2016-08-09,2016-08-10,2016-08-11,2016-08-12,2016-08-13,2016-08-14,2016-08-15 19205,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Ich brauche wenn Wert in Spalte! = 0, ersetzen Sie es auf 1. (3 ersetzen auf 1, 7 ersetzen auf 1 etc.) Ich muss json wie dieses Format bekommen. (In df gibt es alle Tage, aber ich brauche es bis Monate) { "19205": { "2015-05": 0, "2015-06": 0, […]

Wenn JSON Key Else existiert

Ich hoffe du hast einen schönen Tag! Ich versuche, die {'green color','road','street','yellow color'} die ich mit dieser Funktion in Python 3 machen konnte, aber ich möchte nur, dass es zurückkommt, wenn der Schlüssel "KLASSEN" Existiert im Wörterbuch "json_data". Wenn ich die Funktion mit dem folgenden JSON-Code ausführe, funktioniert es aber wenn ich einen anderen Code […]

Schreiben Sie JSON-Elemente in csv-Datei python

Ich habe gerade ein Python-Programm, das Google Webmaster API kratzt, um zu überprüfen, ob die target_site mobil ist freundlich oder nicht & dann basiert auf Antwort es extrahiert bestimmte Json Elemente. Auch erfaßt es den Screenshot im lokalen Ordner Das Skript funktioniert gut, aber wenn ich versuche, diese json-Objekte zu csv-Datei zu schreiben, funktioniert es […]

TypeError: Das JSON-Objekt muss str sein, nicht 'Response' mit Python 3.4

Ich bekomme diesen Fehler und ich kann nicht herausfinden, was das Problem ist: Traceback (most recent call last): File "C:/Python34/Scripts/ddg.py", line 8, in <module> data = json.loads(r) File "C:\Python34\lib\json\__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'Response' Das ist mein Code: import requests, json search_q = input('Enter query: ') […]

Parse Json Daten in Python

Ich habe Probleme beim Analysieren der daraus resultierenden Json-Daten, um nur den gewünschten Abschnitt zurückzukehren (zB 'name', 'beleg', 'status'). Wie kann ich die Ausgabe ändern, um diese Artikel nur zu drucken? Code: for coro in tqdm(asyncio.as_completed(tasks, loop=loop)): try: response = await coro if response is None: continue data, store = response result = json.loads(data['searchResults'])['results'][0] summary […]

Zugriff auf den Benutzernamen aller Anhänger eines Benutzers in Instagram mit Scrapy oder Instagram Python API

Wie bekomme ich den Benutzernamen eines jeden Anhängers eines Benutzers in Instagram? Im json kann ich nur auf die zahl der anhängern Hier ist die URL für json Verarbeitung Ich benutze: "https://www.instagram.com/buzzfeed/?__a=1" pprint(json_response["user"]["followed_by"]["count"]) Hier ist der Anfang von pprint(json_response["user"]) {u'biography': u"Hi, we're:q BuzzFeed dot com the website. Download our app:", u'blocked_by_viewer': False, u'connected_fb_page': None, u'country_block': […]

Python parsing json daten mit doppelten zitaten

Wie analysieren Sie json Daten mit doppelten Anführungszeichen innerhalb: json.loads(' { "time":"1410661614", "text":"This is great", "from": { "username":"mrb", "id":"5071", "full_name":"Free "Mrb"" #here is the problem }, "id":"8090107" } ') Python kehrt zurück ValueError: Expecting ',' delimiter: line 1 column 107 (char 106)

Extrahieren von Daten (likes) von JSON API mit Python

Ich möchte die Anzahl von Likes für mein Projekt ziehen. Hier ist mein Code: import facepy from facepy import GraphAPI from bs4 import BeautifulSoup import json access = 'CAACEdEose0cBAE3IL99IreDeAfqaVZBOje8ZCqIhf6tPaf7HsPF3J9DYRWi3YuSTf0HXQwr2LMAgczDBWBSDNFzHrEjxzkBQ9hbZCYC1fB2z1qyHs5BeAZCV3zyU8JhEcbSiiB5Bf73gZAfQ1rUa2pdx9U24dUZCX0qMDzvXHLHV9jPRiZBByB2b2uEHGk22M4ZD' graph = GraphAPI(access) page_id= 'walkers' datas= graph.get(page_id+'/', page=True, retry=5) for data in datas: print data Und hier ist die Ausgabe: { u'category': u'Product/Service', u'username': u'walkers', u'about': […]

JSON verging von Python (Flasche) in JavaScript wird auf dem Bildschirm angezeigt

Ich gebe einen JSON von einem Python-Back-End in mein Front-End-JavaScript, wo ich eine webGL (three.js) Animation betreibe. Der JSON enthält numerische Werte, die bestimmen, was in der Animation passiert. Mein Problem ist, dass, während ich eine grundlegende ajax Anforderung Arbeit habe, wird der JSON auf den Bildschirm (anstelle der Animation) gedruckt, anstatt eine Variable zu […]

Python ist die beste Programmiersprache der Welt.