Skip to content

Commit

Permalink
Merge pull request #30 from amices/zahroh
Browse files Browse the repository at this point in the history
Installation and get started vignettes
  • Loading branch information
stefvanbuuren authored Mar 11, 2024
2 parents 8eb6111 + 731deec commit 69c8810
Show file tree
Hide file tree
Showing 32 changed files with 6,547 additions and 0 deletions.
1 change: 1 addition & 0 deletions .host
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://localhost:8080
33 changes: 33 additions & 0 deletions .ipynb_checkpoints/doc_python-checkpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@



import requests
host = "http://localhost:8080"


import requests # Import the requests library

# Query URL
url = ('http://ec.europa.eu/eurostat/wdds/rest/data/v2.1/json/en'
'/nama_10_gdp?precision=1'
'&unit=CLV05_MEUR' # Unit: CLV (2005) Million EUR
'&geo=NL&geo=DE' # Country: Netherlands, Germany
'&time=2010&time=2011&time=2012' # Years: 2010, 2011, 2012
'&na_item=B1GQ&na_item=D21' # GDP (market prices) & taxes on products
)
# Some api's will have nicer syntax like:
# `&time=2010..2012` or `&na_item=B1GQ,D21`
print(url)

response = requests.get(url) # Make a GET request to the URL

# Print status code (and associated text)
print(f"Request returned {response.status_code} : '{response.reason}'")

# Print data returned (parsing as JSON)
payload = response.json() # Parse `response.text` into JSON

import pprint
pp = pprint.PrettyPrinter(indent=1)
pp.pprint(payload)
# NOTE: Could use print(response.json()) but this wouldn't be formatted nicely
Loading

0 comments on commit 69c8810

Please sign in to comment.