Created
May 28, 2021 09:16
-
-
Save henhuy/a1c1de6ab8da54cf32050d69e3ed1941 to your computer and use it in GitHub Desktop.
Modex big data scenario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import ijson | |
import rapidjson | |
import simplejson | |
CONNECTOR_URL = "https://modex.rl-institut.de/scenario/id/" | |
SCENARIO_ID = 42 | |
def get_scenario_data(scenario_id): | |
print(f"Requesting data for scenario #{scenario_id}...") | |
response = requests.get( | |
CONNECTOR_URL + str(scenario_id), | |
{"mapping": "dashboard", "source": "modex_output"}, | |
timeout=10000, | |
verify=False, | |
) | |
print(f"Loading data for scenario #{scenario_id}...") | |
return response.text | |
content = get_scenario_data(SCENARIO_ID) | |
data = json.loads(content) | |
# data = rapidjson.loads(content) | |
# data = simplejson.loads(content) | |
print(data["oed_scalars"][0]) | |
# print(next(ijson.items(content, "oed_scalars.item"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment