Skip to content

Commit

Permalink
Merge pull request #42 from open-contracting/update-urls
Browse files Browse the repository at this point in the history
Update source URLs for Uganda and West Lombok
  • Loading branch information
duncandewhurst authored Jul 29, 2024
2 parents 2961f45 + cbed95c commit 6888a6a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions OC4IDS_Database_Data_Import.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"1. Add a `source_id` for the publisher in the [Choose a data source](#scrollTo=HFTcVz0Q0tMr) section.\n",
"2. In the [Download data](#scrollTo=veSGp6SIwYRt) section:\n",
" 1. Add the `source_id` and download URL to `sources`.\n",
" 1. If the data is not accessible as a single project package via a simple `GET` request, add an [`elif`](https://docs.python.org/3/reference/compound_stmts.html#elif) part to the `if` statement with code that returns a single project package named `project_package.json`. \n",
" 1. If the data is not accessible as a single project package via a simple `GET` request, add an [`elif`](https://docs.python.org/3/reference/compound_stmts.html#elif) part to the `if` statement with code that returns a single project package named `project_package.json`.\n",
"\n",
"**Having problems?**\n",
"\n",
Expand Down Expand Up @@ -105,25 +105,25 @@
" 'mexico_cost_jalisco': 'http://www.costjalisco.org.mx/jsonprojects',\n",
" 'ghana_cost_sekondi_takoradi': 'https://costsekondi-takoradigh.org/uploads/projectJson.json',\n",
" 'mexico_nuevo_leon': 'http://si.nl.gob.mx/siasi_ws/api/edcapi/DescargarProjectPackage',\n",
" 'indonesia_cost_west_lombok': 'https://intras.fllajlombokbaratkab.or.id/oc4ids',\n",
" 'indonesia_cost_west_lombok': 'https://intras.lombokbaratkab.go.id/oc4ids',\n",
" 'ukraine_cost_ukraine': 'https://portal.costukraine.org/data.json',\n",
" 'uganda_gpp': 'https://gppflattener.app/download?format=json',\n",
" 'uganda_gpp': 'https://gpp.ppda.go.ug/adminapi/public/api/open-data/v1/infrastructure/projects/download?format=json',\n",
" 'malawi_cost_malawi': 'https://ippi.mw/api/projects/query'\n",
"}\n",
"\n",
"if source_id == 'malawi_cost_malawi':\n",
" # The IPPI API accepts a POST request JSON-encoded start_date and end_date paramters\n",
" # The IPPI API accepts a POST request with JSON-encoded start_date and end_date paramters\n",
" payload = {\n",
" \"start_date\": \"2010-01-01\",\n",
" \"end_date\": datetime.today().strftime('%Y-%m-%d')\n",
" }\n",
" response = requests.post(sources[source_id], json=payload)\n",
" \n",
"\n",
" with open('project_package.json', 'wb') as f:\n",
" f.write(response.content)\n",
"\n",
"else:\n",
" response = requests.get(sources[source_id])\n",
" response = requests.get(sources[source_id], verify=False)\n",
"\n",
" with open('project_package.json', 'wb') as f:\n",
" f.write(response.content)\n"
Expand Down

0 comments on commit 6888a6a

Please sign in to comment.