Как ссылаться на вложенный словарь в Python и не знаю как, пожалуйста, дайте объяснение - PullRequest
0 голосов
/ 10 июля 2020

Итак, я использую API приличного размера для создания бота Discord. У меня возникли проблемы с получением необходимой информации из API из-за вложенного словаря. Я взял api, превратил его в json и использую его как свой словарь. Я могу назвать статус просто прекрасным, потому что он находится на вершине дерева, но я совершенно заблудился, когда дело доходит до спуска по дереву. Пожалуйста, помогите!

Вот мой код:


import urllib

from urllib.request import urlopen as open

import json


url = 'https://fortnite-api.com/v2/shop/br/combined'

#opens url

json_obj = open(url)

#saves to json

json_data = json.load(json_obj)

#prints URL

print(url)

###variables for dictionary's

json_status = json_data['status']


#prints API Status, 200 is connected

print('API Status: ' + str(json_status))    



#Going down the tree, am lost

json_names = json_data['data']['featured']['entries']['items']['name']

print(json_names)

Дерево json находится по этой ссылке в разделе «BR Shop Combined». Просто нажмите «Ответы». Это слишком сложно печатать. https://dash.fortnite-api.com/

Вот json: {"status": 200, "data": {"ha sh": "aefe4148418f3406bfd155349369360c70e13534", "date": "2020 -07-10T00: 00: 00Z "," Featured ": {" name ":" Featured "," entries ": [{" regularPrice ": 2000," finalPrice ": 2000," bundle ": null," banner " : {"value": "Выбираемые стили!", "backendValue": "SelectableStyles"}, "giftable": true, "returnable": true, "sortPriority": - 11, "Categories": ["Panel 3"] , "имя_устройство": "[ВИРТУАЛЬНЫЙ] 1 х влажный Merman, 1 х Mertank за 2000 MtxCurrency", "offerId": "v2: / ecbc2dd0399e9510014273e231bf6b1ae6cd0caeb3d1da754a0715a55615f6e3", "displayAssetPath": "FortniteGame / Содержание / Каталог / DisplayAssets / DA_Featured_CID_130_Athena_Commando_M_Merman",» items ": [{" id ":" CID_130_Athena_Commando_M_Merman "," name ":" Moisty Merman "," description ":" Из влажных глубин ... задней части Studio B. "," type ": {" value ":" экипировка "," displayValue ":" Outfit "," backendValue ":" AthenaCharacter "}," rarity ": {" value ":" легендарный "," displayValue ":" Legendary "," backendValue ":" EFortRarity :: Легендарный "}," сериал ": n ull, "set": null, "Introduction": {"chapter": "1", "season": "4", "text": "Представлено в главе 1, сезон 4.", "backendValue": 4} , "images": {"smallIcon": "https://fortnite-api.com/images/cosmetics/br/cid_130_athena_commando_m_merman/smallicon.png", "icon": "https://fortnite-api.com/images/cosmetics/br/cid_130_athena_commando_m_merman/icon.png", "Feature": "https://fortnite-api.com/images/cosmetics/br/cid_130_athena_commando_m_merman/featured.png", "other": null}, "options": [{" канал ":" Материал "," тип ":" ЦВЕТ "," параметры ": [{" тег ":" Мат1 "," имя ":" ПО УМОЛЧАНИЮ "," изображение ":" https://fortnite-api.com/images/cosmetics/br/cid_130_athena_commando_m_merman/variants/material/mat1.png "}, {" tag ":" Mat2 "," name ":" СИНИЙ "," image ":" https://fortnite-api.com/images/cosmetics/br/cid_130_athena_commando_m_merman/variants/material/mat2.png "}, {" tag ":" Mat3 "," name ":" ORANGE "," image ":" https://fortnite-api.com/images/cosmetics/br/cid_130_athena_commando_m_merman/variants/material/mat3.png "}, {" tag ":" Mat4 "," name ":" PURPLE "," image ":" https://fortnite-api.com/images/cosmetics/br/cid_130_athena_commando_m_merman/variants/material/mat4.png "}]}]," gameplayTags ": [" Cosmetics.Source.ItemShop "," Cosmetics .UserFacingFlags.HasVariants »,« Cosmetics.Filter.Season.4 »],« showcaseVideo »:« TGD91vW8vnw »,« displayAssetPath »:« FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_CID_130_Athena_CommandGo_M »,« Определение содержимого Афина / Герои / HID_130_Athena_Commando_M_Merman "," путь ":" FortniteGame / Контент / Афина / Предметы / Косметика / Персонажи / CID_130_Athena_Commando_M_Merman "," добавлено ":" 2019-11-20T12: 50: 24Zory ":" Shop -05-25T00: 00: 00Z "," 2018-05-26T00: 00: 00Z "," 2018-06-28T00: 00 : 00Z "," 2018-07-31T00: 00: 00Z "," 2018-09-04T00: 00: 00Z "," 2018-12-05T00: 00: 00Z "," 2019-09-13T00: 00: 00Z "," 2019-09-14T00: 00: 00Z "," 2019-10-16T00: 00: 00Z "," 2019-11-25T00: 00: 00Z "," 2020-02-04T00: 00: 00Z ", «2020-03-23T00: 00: 00Z», «2020-04-28T00: 00: 00Z», «2020-06-05T00: 00: 00Z», «2020-07-10T00: 00: 00Z»]}, {"id": "BID_051_Merman", "name": "Mertank", "description": "Дышите спокойно.", "type": {"value": "рюкзак", "displayValue": "Back Bling", " backendValue ":" AthenaBackpack "}," rarity ": {" value ":" легендарный "," displayValue ":" Legendary "," backendValue ":" EFortRarity :: Legendary "}," series ": null," set " : null, "Introduction": {"chapter": "1", "season": "4", "text": "Представлено в главе 1, сезон 4.", "backendValue": 4}, "images": {"smallIcon": "https://fortnite-api.com/images/cosmetics/br/bid_051_merman/smallicon.png", "icon": "https://fortnite-api.com/images/cosmetics/br/bid_051_merman/icon.png", "Feature": null, "other": null}, "options": null, "gameplayTags": ["Cosmetics.Source. ItemShop »,« Косметика.Фильтр.Сезон. 4 "]," showcaseVideo ":" enU9gwEHRm8 "," displayAssetPath ": null," definitionPath ": null," path ":" FortniteGame / Content / Athena / Items / Cosmetics / Backpacks / BID_051_Merman "," added ":" 2019 -11-20T12: 50: 40Z "," shopHistory ": [" 2020-06-05T00: 00: 00Z "," 2020-07-10T00: 00: 00Z "]}]}, {" regularPrice ": 2000, "finalPrice": 2000, "bundle": null, "banner": {"value": "Кирка в комплекте!", "backendValue": "PickaxeIncluded"}, "giftable": true, "возмещаемый": true, "sortPriority ": -1," категории ": [" Панель 1 "]," devName ":" [ВИРТУАЛЬНО] 1 x Капитан Америка, 1 x Протоадамантиевый щит, 1 x Прото-адамантиевый щит за 2000 MtxCurrency "," offerId " : "v2: / 5c87c543d74ffa7b7e02058387908f5285afe87a1540c94bf9e5b2157fc0640b", "displayAssetPath": "FortniteGame / Содержание / Каталог / DisplayAssets / DA_Featured_CID_807_Athena_Commando_M_CandyApple_B1U7X", "элементы": [{ "ID": "CID_807_Athena_Commando_M_CandyApple_B1U7X", "имя": "Капитан Америка", "описание" : "Суперсолдат Стив Роджерс стоит как стойкий страж свободы.", "Type": {"value": "outfit", "displayValue": "Outfit", "bac kendValue ":" AthenaCharacter "}," rarity ": {" value ":" marvel "," displayValue ":" MARVEL SERIES "," backendValue ":" EFortRarity :: Epi c "}," series ": { "value": "MARVEL SERIES", "image": null, "backendValue": "MarvelSeries"}, "set": {"value": "Avengers", "text": "Часть набора Avengers.", "backendValue": "AshtonBoardwalk"}, "Introduction": {"chapter": "2", "season": "3", "text": "Представлено в главе 2, сезон 3.", "backendValue": 13 }, "images": {"smallIcon": "https://fortnite-api.com/images/cosmetics/br/cid_807_athena_commando_m_candyapple_b1u7x/smallicon.png", "icon": "https://fortnite-api.com/images/cosmetics/br/cid_807_athena_commando_m_candyapple_b1u7x/icon.png", "Popular": "https://fortnite-api.com/images/cosmetics/br/cid_807_athena_commando_m_candyapple_b1u7x/featured.png", "other": null}, "options": null, «gameplayTags»: [«Cosmetics.Source.ItemShop», «Cosmetics.Filter.Season.13», «Cosmetics.Set.AshtonBoardwalk»], «showcaseVideo»: «p-bxqi30cGU», «displayAssetPath»: «FortniteGame / Content / Каталог / DisplayAssets / DA_Featured_CID_807_Athena_Commando_M_CandyApple_B1U7X " "definitionPath": "FortniteGame / Content / Athena / Герои / HID_807_Athena_Commando_M_CandyApple", "путь": "FortniteGame / Содержание / Athena / товары / Косметика / Персонажи / CID_807_Athena_Commando_M_CandyApple_B1U7X", "добавил":" 2020 -07-03T00: 00: 00Z "," shopHistor y ": [" 2020-07-03T00: 00: 00Z "," 2020-07-04T00: 00: 00Z "," 2020-07-05T00: 00: 00Z "," 2020-07-06T00: 00: 00Z "," 2020-07-07T00: 00: 00Z "," 2020-07-08T00: 00: 00Z "," 2020-07-09T00: 00: 00Z "," 2020-07-10T00: 00: 00Z "] }, {"id": "BID_560_CandyApple_WTXXO", "name": "Протоадамантиевый щит", "description": "Щит Капитана Америки нерушим, как и его воля.", "type": {"value": "рюкзак "," displayValue ":" Back Bling "," backendValue ":" AthenaBackpack "}," rarity ": {" value ":" marvel "," displayValue ":" MARVEL SERIES "," backendValue ":" EFortRarity :: Epi c "}," series ": {" value ":" MARVEL SERIES "," image ": null," backendValue ":" MarvelSeries "}," set ": {" value ":" Avengers "," text ":" Часть набора Мстителей. "," backendValue ":" AshtonBoardwalk "}," Introduction ": {" chapter ":" 2 "," season ":" 3 "," text ":" Представлено в главе 2, Сезон 3. "," backendValue ": 13}," images ": {" smallIcon ":" https://fortnite-api.com/images/cosmetics/br/bid_560_candyapple_wtxxo/smallicon.png "," icon ":" https://fortnite-api.com/images/cosmetics/br/bid_560_candyapple_wtxxo/icon.png "," Feature ": null," other ": null }, «варианты»: null, «gameplayTags»: [«Cosmetics.Source.ItemShop», «Cosmetics.Filter.Season.13», «Cosmetics.Set.AshtonBoardwalk»], «sho wcaseVideo ": null," displayAssetPath ": null," definitionPath ": null," path ":" FortniteGame / Content / Athena / Items / Cosmetics / Backpacks / BID_560_CandyApple_WTXXO "," added ":" 2020-07-03T00: 00: 00Z »,« shopHistory »: [« 2020-07-03T00: 00: 00Z »,« 2020-07-04T00: 00: 00Z »,« 2020-07-05T00: 00: 00Z »,« 2020-07-06T00 : 00: 00Z "," 2020-07-07T00: 00: 00Z "," 2020-07-08T00: 00: 00Z "," 2020-07-09T00: 00: 00Z "," 2020-07-10T00: 00 : 00Z "]}, {" id ":" Pickaxe_ID_420_CandyAppleSour_JXBZA "," name ":" Протоадамантиевый щит "," description ":" Щит Капитана Америки неуязвим, как и его воля. "," Type ": {" value ":" кирка "," displayValue ":" Инструмент для сбора урожая "," backendValue ":" AthenaPickaxe "}," rarity ": {" value ":" marvel "," displayValue ":" MARVEL SERIES "," backendValue ": "EFortRarity :: Epi c"}, "series": {"value": "MARVEL SERIES", "image": null, "backendValue": "MarvelSeries"}, "set": {"value": " Avengers "," text ":" Часть набора Avengers. "," BackendValue ":" AshtonBoardwalk "}," Introduction ": {" chapter ":" 2 "," season ":" 3 "," text ": "Представлено в главе 2, сезон 3. "," backendValue ": 13}," images ": {" smallIcon ":" https://fortnite-api.com/images/cosmetics/br/pickaxe_id_420_candyapplesour_jxbza/smallicon.png "," icon ":" https://fortnite-api.com/images/cosmetics/br/pickaxe_id_420_candyapplesour_jxbza/icon.png "," Feature ":" https://fortnite-api.com/images/cosmetics/br/pickaxe_id_420_candyapplesour_jxbza/featured.png "," other ": null} , «варианты»: null, «gameplayTags»: [«Cosmetics.Filter.Season.13», «Cosmetics.Source.ItemShop», «Cosmetics.Set.AshtonBoardwalk»], «showcaseVideo»: null, «displayAssetPath»: » FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_Pickaxe_ID_420_CandyAppleSour "," definitionPath ":" FortniteGame / Content / Athena / Items / Weapons / WID_Harvest_Pickaxe_CandyAppleSour "," path ":" FortniteGame_Apple / Content / Content / добавлено ":" 2020-07-03T00: 00: 00Z "," shopHistory ": [" 2020-07-03T00: 00: 00Z "," 2020-07-04T00: 00: 00Z "," 2020-07-05T00 : 00: 00Z "," 2020-07-06T00: 00: 00Z "," 2020-07-07T00: 00: 00Z "," 2020-07-08T00: 00: 00Z "," 2020-07-09T00: 00 : 00Z "," 2020-07-10T00: 00: 00Z "]}]}, {" regularPrice ": 300," finalPrice ": 300," bundle ": null," banner ": {" value ":" Собрать набор! "," backendValue ":" CollectTheSet "}," giftable ": true," возмещаемый ": true," sortPriority ": - 2," Categories ": [" Panel 1 "]," devName ":" [ ВИРТУАЛЬНО] 1 x Большой салют за 300 MtxCurrency "," offerId ":" v2: / 6ab15fb50c05fddda89b729cdac2be0c62b51657a1aed9a6c7d0a081cb85cbed "," displayAssetPath ":": "FortniteGame / Content / Catalog / DisplayAssetPath": "FortniteGame_ID_ID_FX_Assets / DisplayFeatures ":" Большой салют "," description ":" Приветствие всем героям. "," Type ": {" value ":" emote "," displayValue ":" Emote "," backendValue ":" AthenaDance "}, "rarity": {"value": "marvel", "displayValue": "MARVEL SERIES", "backendValue": "EFortRarity :: Epi c"}, "series": {"value": "MARVEL SERIES" , "image": null, "backendValue": "MarvelSeries"}, "set": {"value": "Avengers", "text": "Часть набора Avengers.", "backendValue": "AshtonBoardwalk"} , "Introduction": {"chapter": "2", "season": "3", "text": "Представлено в главе 2, Season 3.", "backendValue": 13}, "images": {" smallIcon ":" https://fortnite-api.com/images/cosmetics/br/eid_fireworks_wkx2w/smallicon.png "," icon ":" https://fortnite-api.com/images/cosmetics/br/eid_fireworks_wkx2w/icon.png "," Feature ":" https://fortnite-api.com/images/cosmetics/br/eid_fireworks_wkx2w/featured.png "," other ": null}," options ": null," gameplayTags ": [" Cosmetics. EmoteType.Dance »,« Cosmetics.Source.ItemShop »,« Cosmetics.Filter.Season.13 »,« Cosmetics.Set.AshtonBoardwalk »],« showcaseV ideo »:« IntyXGvu98Q »,« displayAssetPath »:« FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_EID_Fireworks »,« definitionPath »: null,« path »:« FortniteGame / Content / Athena / Items / Cosmetics / Dances / EID_Fireworks_WKX2 » добавлено ":" 2020-07-03T00: 00: 00Z "," shopHistory ": [" 2020-07-03T00: 00: 00Z "," 2020-07-04T00: 00: 00Z "," 2020-07-05T00 : 00: 00Z "," 2020-07-06T00: 00: 00Z "," 2020-07-07T00: 00: 00Z "," 2020-07-08T00: 00: 00Z "," 2020-07-09T00: 00 : 00Z "," 2020-07-10T00: 00: 00Z "]}]}, {" regularPrice ": 1200," finalPrice ": 1200," bundle ": null," banner ": null," giftable ": true , "возмещаемый": true, "sortPriority": - 1, "Categories": ["Panel 1"], "devName": "[ВИРТУАЛЬНЫЙ] 1 x Airhead для 1200 MtxCurrency", "offerId": "v2: / 1b0d0d420617bec2104b1b1bfabf10232cfcfae69 "," displayAssetPath ":" FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_CID_432_Athena_Commando_M_Balloonhead "," items ": [{" id ":" CID_432_Athena_Commando_M_BalloonHead "," описание "в" название "AirBalloonHead", "описание" , "type": {"value": "экипировка", "displayValue": "Outfit", "backen dValue ":" AthenaCharacter "}," rarity ": {" value ":" Red "," displayValue ":" Rare "," backendValue ":" EFortRarity :: Rare "}," series ": null," set " : null, "Introduction": {"chapter": "1", "season": "9", "text": "Представлено в главе 1, Season 9.", "backendValue": 9}, "images": {"smallIcon": "https://fortnite-api.com/images/cosmetics/br/cid_432_athena_commando_m_balloonhead/smallicon.png", "icon": "https://fortnite-api.com/images/cosmetics/br/cid_432_athena_commando_m_balloonhead/icon.png", "Feature": "https://fortnite-api.com/images/cosmetics/br/cid_432_athena_commando_m_balloonhead/featured.png", "other": null}, "options": null, "gameplayTags": [" Cosmetics.Source.ItemShop »,« Косметика.Фильтр.Сезон. 9 "]," showcaseVideo ":" ZPcLdkApjV c "," displayAssetPath ":" FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_CID_432_Athena_Commando_M_Balloonhead "," definitionPath "," definitionPath "/ HERO_MAD_HAD_MAD_ /" Путь_Hero_Art_Art / "/ ContentPath_M_Hero_Med_Ha_Ma_ / путь_Hero_Med_Ha_Ma_d_Ma_ / путь_Hero_Mand_Ma_Ha_Ma_ / Путь_HИГЕРА_ХИБА / : "FortniteGame / Content / Athena / Items / Cosmetics / Characters / CID_432_Athena_Commando_M_BalloonHead", "added": "2019-11-20T12: 49: 58Z", "shopHistory": ["2020-06-07T00: 00: 00Z", «2020-07-10T00: 00: 00Z»]}]}, {«regularPrice»: 1200, «finalPrice»: 1200, «bundle»: null, «banner»: null, «giftable»: true, «возмещаемый» : true, "sortPriority": - 6, "Categories": ["Panel 2"], "devName": "[VIRTUAL] 1 x Beach Bomber, 1 x Brite Board за 1200 MtxCurrency", "offerId": "v2: / dea01128e0b6f6be9111f3af81c4570e279b060f4c489edaf8a37ce5b5e59ce2" , "displayAssetPath": "FortniteGame / Содержание / Каталог / DisplayAssets / DA_Featured_CID_460_Athena_Commando_F_BriteBomberSummer", "элементы": [{ "ID": "CID_460_Athena_Commando_F_BriteBomberSummer", "имя": "Пляж Bomber", "описание": "Сделать пляжная вечеринка brite! "," type ": {" value ":" экипировка "," displayValue ":" Outfit "," backendValue ":" AthenaCharacter "}," rarity ": {" value ":" Red "," displayValue ":" Rare "," backendValue ":" EFortRarity :: Rare "}," series ": null," set ": {" value ":" Sunshine And Rainbows "," text ":" Часть набора Sunshine And Rainbows. "," BackendValue ":" SunshineAndRainbows " }, "Introduction": {"chapter": "1", "season": "9", "text": "Представлено в главе 1, Season 9.", "backendValue": 9}, "images": { "smallIcon": "https://fortnite-api.com/images/cosmetics/br/cid_460_athena_commando_f_britebombersummer/smallicon.png", "icon": "https://fortnite-api.com/images/cosmetics/br/cid_460_athena_commando_f_britebombersummer/icon.png", "Feature": "https://fortnite-api.com/images/cosmetics/br/cid_460_athena_commando_f_britebombersummer/featured.png", "other": null}, "options": null, "gameplayTags": ["Косметика .Source.ItemShop »,« Cosmetics.Set.SunshineAndRainbows »,« Cosmetics.Filter.Season.9 »],« showcaseVideo »:« G8nuKcFVMHE »,« displayAssetPath »:« FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_AtomBa_4 definitionPath ":" FortniteGame / Content / Athena / Heroes / HID_460_Athena_Commando_F_BriteBomberSummer "," path ":" FortniteGame / Content / Athena / Items / Cosmetics / Characters / CID_460_Athena_Commando_F_BriteBom added: "49-11-20d:" , "shopH istory »: [« 2019-07-07T00: 00: 00Z »,« 2019-07-08T00: 00: 00Z »,« 2019-07-13T00: 00: 00Z »,« 2019-08-18T00: 00: 00Z » "," 2019-10-19T00: 00: 00Z "," 2020-07-08T00: 00: 00Z "," 2020-07-09T00: 00: 00Z "," 2020-07-10T00: 00: 00Z "] }, {"id": "BID_299_BriteBomberSummer", "name": "Brite Board", "description": "Уничтожьте солнечный свет.", "type": {"value": "backpack", "displayValue": "Назад Bling "," backendValue ":" AthenaBackpack "}," rarity ": {" value ":" Red "," displayValue ":" Rare "," backendValue ":" EFortRarity :: Rare "}," series ": null , "set": {"value": "Sunshine And Rainbows", "text": "Часть набора Sunshine And Rainbows.", "backendValue": "SunshineAndRainbows"}, "Introduction": {"chapter": " 1 "," season ":" 9 "," text ":" Представлено в главе 1, сезон 9. "," BackendValue ": 9}," images ": {" smallIcon ":" https://fortnite-api.com/images/cosmetics/br/bid_299_britebombersummer/smallicon.png "," icon ":" https://fortnite-api.com/images/cosmetics/br/bid_299_britebombersummer/icon.png "," Featured ": null," other ": null}," options ": null," gameplayTags ": [" Cosmetics.Source.ItemShop "," Cosmetics.Set.SunshineAndRainbows "," Cosmetics .Filter.Season.9 "]," showcaseVideo ": null," displayAssetPath ": null," definitionPath ": null," path ":" FortniteGame / Content / A thena / Предметы / Косметика / Рюкзаки / BID_299_BriteBomberSummer "," added ":" 2019-11-20T12: 50: 33Z "," shopHistory ": [" 2020-07-08T00: 00: 00Z "," 2020-07-09T00 : 00: 00Z "," 2020-07-10T00: 00: 00Z "]}]}, {" regularPrice ": 1200," finalPrice ": 1200," bundle ": null," banner ": null," Giftable " : true, «возмещаемый»: true, «sortPriority»: - 6, «Categories»: [«Panel 2»], «devName»: «[VIRTUAL] 1 x Crypti c, 1 x Spectral Spine за 1200 MtxCurrency» "offerId": "v2: / 56c1d1e0bbda67ac75d7a1df8e2ec9d5b0853c1a55b71e0c2dfa15b890bc9e17", "displayAssetPath": "FortniteGame / Содержание / Каталог / DisplayAssets / DA_Featured_CID_413_Athena_Commando_M_StreetDemon", "элементы": [{ "ID": "Имя", "CID_413_Athena_Commando_M_StreetDemon": "Crypti c "," description ":" Мастер тайн. "," type ": {" value ":" outfit "," displayValue ":" Outfit "," backendValue ":" AthenaCharacter "}," rarity ": {" value ":" редкий "," displayValue ":" Rare "," backendValue ":" EFortRarity :: Rare "}," series ": null," set ": {" value ":" Crypti c "," text ":" Часть набора Crypti c. "," backendValue ":" StreetDemon "}," Introduction ": {" chapter ":" 1 "," season ":" 9 "," text ":" Представлено в главе 1, Season 9. "," backendValue " : 9}, "images": {"smallIcon": "https://fortnite-api.com/images/cosmetics/br/cid_413_athena_commando_m_streetdemon/smallicon.png", "icon": "https://fortnite-api.com/images/cosmetics/br/cid_413_athena_commando_m_streetdemon/icon.png", "Feature": "https://fortnite-api.com/images/cosmetics/br/cid_413_athena_commando_m_streetdemon/featured.png", "other": null}, "options": null, «gameplayTags»: [«Cosmetics.Source.ItemShop», «Cosmetics.Set.StreetDemon», «Cosmetics.Filter.Season.9»], «showcaseVideo»: «HrIc_ZMLSQw», «displayAssetPath»: «FortniteGame / Content / Каталог / DisplayAssets / DA_Featured_CID_413_Athena_Commando_M_StreetDemon "," definitionPath ":" FortniteGame / Content / Athena / Heroes / HID_413_Athena_Commando_M_StreetDemon "," Предметы COSMETA_Demon "," путь ":" FortniteGame_ID_M_ / добавлено: "FortniteGame_ID_M / 2019:" FortniteGame_ID_ / COSMETA / Добавлено: "FortniteGame_ID_A / 2019 -11-20T12: 49: 59Z »,« shopHistory »: [« 2019-05-10T00: 00: 00Z »,« 2019-05-11T00: 00: 00Z »,« 2019-06-13T00: 00: 00Z » , "2019-07-25T00: 00: 00Z", "2019-09-01T00: 00: 00Z", "2019-10-01T00: 00: 00Z", "2019-11-05T00: 00: 00Z", " 2019-12-06T00: 00: 00Z "," 2019-12-18T00: 00: 00Z "," 2020-01-23T00: 00: 00Z "," 2020-03-03T00: 00: 00Z "," 2020- 04-06T00: 00: 00Z "," 2020 -05-08T00: 00: 00Z "," 2020-06-08T00: 00: 00Z "," 2020-07-10T00: 00: 00Z "]}, {" id ":" BID_270_StreetDemon "," name ":" Spectral Spine "," description ":" Покажи позвоночник. "," Type ": {" value ":" backpack "," displayValue ":" Back Bling "," backendValue ":" AthenaBackpack "}," rarity ": {"value": "Red", "displayValue": "Rare", "backendValue": "EFortRarity :: Rare"}, "series": null, "set": {"value": "Crypti c" , "text": "Часть набора Crypti c.", "backendValue": "StreetDemon"}, "Introduction": {"chapter": "1", "season": "9", "text" : "Представлено в Главе 1, Сезон 9.", "BackendValue": 9}, "images": {"smallIcon": "https://fortnite-api.com/images/cosmetics/br/bid_270_streetdemon/smallicon.png", "icon": "https://fortnite-api.com/images/cosmetics/br/bid_270_streetdemon/icon.png", "Feature": null, "other": null}, "options": null, "gameplayTags": ["Cosmetics.Source.ItemShop", "Cosmetics.Set.StreetDemon", "Cosmetics.Filter.Season.9"], "showcaseVideo": null , "displayAssetPath": null, "definitionPath": null, "path": "FortniteGame / Content / Athena / Items / Cosmetics / Backpacks / BID_270_StreetDemon", "added": "2019-11-20T12: 50: 34Z", " shopHistory »: [« 2020-05-08T00: 00: 00Z »,« 2020-06-08T00: 00: 00Z »,« 2020-07-10T00: 00: 00Z » "]}]}, {" regularPrice ": 800," finalPrice ": 800," bundle ": null," banner ": {" value ":" It's Back! "," backendValue ":" Back "}," giftable ": true," возмещаемый ": true," sortPriority ": - 12," Categories ": [" Panel 3 "]," devName ":" [VIRTUAL] 1 x Director's Cut за 800 MtxCurrency "," offerId ": "v2: / 2e6b8c14d82bf46058709bf4939af260761163c3aeda537446b09053302ff24d", "displayAssetPath": "FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_Pickaxe_ID_054_FilmCamera", "," IDCamera_ID_054_FilmCamera: "," ID_Camera_ID_054_FilmCamera: "," ID_Camera_ID_054_FilmCamera: " "Lights, Camera, Axin '.", "Type": {"value": "pickaxe", "displayValue": "Harvesting Tool", "backendValue": "AthenaPickaxe"}, "rarity": {"value": "Red", "displayValue": "Rare", "backendValue": "EFortRarity :: Rare"}, "series": null, "set": null, "Introduction": {"chapter": "1", " season ":" 4 "," text ":" Представлено в главе 1, сезон 4. "," backendValue ": 4}," images ": {" smallIcon ":" https://fortnite-api.com/images/cosmetics/br/pickaxe_id_054_filmcamera/smallicon.png "," icon ":" https://fortnite-api.com/images/cosmetics/br/pickaxe_id_054_filmcamera/icon.png "," Featured ":" https://fortnite-api.com/images/cosmetics/br/pickaxe_id_054_filmcamera/featured.png "," other ": null}," options ": null," gameplayTags ": [" Cosmetics.Source.ItemShop "," Cosmetics.Filter .Сезон. 4 "]," showcaseVideo ":" l17J96vMojg "," displayAssetPath ":" FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_Pickaxe_ID_054_FilmCamera "," definitionPath ":" FortniteGame / Content / Athena / Items / WeapeCame_Camera_Drive_ID: "Идентификатор оружия / WhatsApp_ID_: "FortniteGame / Content / Athena / Items / Cosmetics / Pickaxes / Pickaxe_ID_054_FilmCamera", "added": "2019-11-20T12: 50: 58Z", "shopHistory": ["2018-05-25T00: 00: 00Z", " 2018-05-26T00: 00: 00Z "," 2018-06-28T00: 00: 00Z "," 2018-07-31T00: 00: 00Z "," 2018-09-04T00: 00: 00Z "," 2018- 12-05T00: 00: 00Z "," 2020-07-10T00: 00: 00Z "]}]}, {" regularPrice ": 500," finalPrice ": 500," bundle ": null," banner ": {" value ":" Animated! "," backendValue ":" Animated "}," giftable ": true," refable ": true," sortPriority ": - 7," Categories ": [" Panel 2 "]," devName " : "[ВИРТУАЛ] 1 x Enigma для 500 MtxCurrency", "offerId": "v2: / 7f82f9fdd21bd5c32230f9c96e6381b627633b1a55b02a554fb96e08cdb8a1c2", "DisplayAssetPath" DisplayAssetPath: "DisplayAssetPath" / "DisplayAssetPath": "DisplayAssetPath" / "DisplayAssetPath": "DisplayAssetPath": "DisplayAssetPath" "Wrap_067_StreetDemon", "name": "Enigma", "des cription ":" Покажите свой стиль. "," type ": {" value ":" wrap "," displayValue ":" Wrap "," backendValue ":" AthenaItemWrap "}," rarity ": {" value ":" редкий "," displayValue ":" Rare "," backendValue ":" EFortRarity :: Rare "}," series ": null," set ": {" value ":" Crypti c "," text ":" Часть набора Crypti c. "," BackendValue ":" StreetDemon "}," Introduction ": {" chapter ":" 1 "," season ":" 9 "," text ":" Представлено в главе 1 , Сезон 9. "," BackendValue ": 9}," images ": {" smallIcon ":" https://fortnite-api.com/images/cosmetics/br/wrap_067_streetdemon/smallicon.png "," icon ":" https://fortnite-api.com/images/cosmetics/br/wrap_067_streetdemon/icon.png "," Feature ": null," other ": null} , «варианты»: null, «gameplayTags»: [«Cosmetics.Source.ItemShop», «Cosmetics.UserFacingFlags.Wrap.Animated», «Cosmetics.Set.StreetDemon», «Cosmetics.Filter.Season.9»], » showcaseVideo »:« KTTUAMlciWE »,« displayAssetPath »:« FortniteGame / Content / Catalog / DisplayAssets / DA_Featured_Wrap_067_StreetDemon »,« definitionPath »: null,« path »:« FortniteGame / Content / Athena / Items / Cosmetics / Item0erapWraps » добавлено ":" 2019-11-20T12: 48: 28Z "," shopHistory ": [" 2019-05-10T00: 00: 00Z "," 2019-05-11T00: 00: 00Z "," 2019-06-13T00 : 00: 00Z "," 2019-07 -25T00: 00: 00Z "," 2019-09-01T00: 00: 00Z "," 2019-10-01T00: 00: 00Z "," 2019-11-05T00: 00: 00Z "," 2019-12-06T00 : 00: 00Z "," 2019-12-18T00: 00: 00Z "," 2020-01-23T00: 00: 00Z "," 2020-03-03T00: 00: 00Z "," 2020-04-06T00: 00 : 00Z "," 2020-05-08T00: 00: 00Z "," 2020-06-08T00: 00: 00Z "," 2020-07-10T00: 00: 00Z "]}]}, {" regularPrice ": 500 , "finalPrice": 500, "bundle": null, "banner": {"value": "Соберите набор!", "backendValue": "CollectTheSet"}, "giftable": true, "возмещаемый": true, «sortPriority»: - 8, «Categories»: [«Panel 2»], «devName»: «[VIRTUAL] 1 x Payload для 500

1 Ответ

1 голос
/ 10 июля 2020

Это будет ["data"]["featured"]["entries"], чтобы получить список записей. Каждая запись представляет собой словарь и имеет ключ items, где связанное значение представляет собой список словарей.

Например: response.json()["data"]["featured"]["entries"][0]["items"][1] Будет вторым элементом первой записи.

import requests


url = "https://fortnite-api.com/v2/shop/br/combined"

response = requests.get(url)
response.raise_for_status()

entries = response.json()["data"]["featured"]["entries"]

for entry in entries:
    for item in entry["items"]:
        print(item)
    print()
...