Skip to content

Commit 17a03b1

Browse files
authored
Add files via upload
1 parent a413b89 commit 17a03b1

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# API requiring registration - POST request"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"### Registering to the API"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": 1,
20+
"metadata": {},
21+
"outputs": [],
22+
"source": [
23+
"# We will use a nutritional analysis API\n",
24+
"# It requires registration (we need an API key to validate ourselves)\n",
25+
"# Many APIs require this kind of registration"
26+
]
27+
},
28+
{
29+
"cell_type": "code",
30+
"execution_count": 2,
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"# You can sign-up for the Developer (Free) edition here: \n",
35+
"# https://developer.edamam.com/edamam-nutrition-api\n",
36+
"\n",
37+
"# API documentation: \n",
38+
"# https://developer.edamam.com/edamam-docs-nutrition-api"
39+
]
40+
},
41+
{
42+
"cell_type": "markdown",
43+
"metadata": {},
44+
"source": [
45+
"### Initial Setup"
46+
]
47+
},
48+
{
49+
"cell_type": "code",
50+
"execution_count": 3,
51+
"metadata": {},
52+
"outputs": [],
53+
"source": [
54+
"# loading the packages\n",
55+
"import requests\n",
56+
"import json"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": 4,
62+
"metadata": {},
63+
"outputs": [],
64+
"source": [
65+
"# Store the ID and Key in variables\n",
66+
"\n",
67+
"#APP_ID = \"your_API_ID_here\"\n",
68+
"#APP_KEY = \"your_API_key_here\"\n",
69+
"\n",
70+
"# Note: Those are not real ID and Key,\n",
71+
"# Replace the string with your own ones that you recieved upon registration"
72+
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": 5,
77+
"metadata": {},
78+
"outputs": [],
79+
"source": [
80+
"# Setting up the request URL\n",
81+
"api_endpoint = \"https://api.edamam.com/api/nutrition-details\"\n",
82+
"\n",
83+
"url = api_endpoint + \"?app_id=\" + APP_ID + \"&app_key=\" + APP_KEY"
84+
]
85+
}
86+
],
87+
"metadata": {
88+
"kernelspec": {
89+
"display_name": "Python 3",
90+
"language": "python",
91+
"name": "python3"
92+
},
93+
"language_info": {
94+
"codemirror_mode": {
95+
"name": "ipython",
96+
"version": 3
97+
},
98+
"file_extension": ".py",
99+
"mimetype": "text/x-python",
100+
"name": "python",
101+
"nbconvert_exporter": "python",
102+
"pygments_lexer": "ipython3",
103+
"version": "3.7.3"
104+
}
105+
},
106+
"nbformat": 4,
107+
"nbformat_minor": 2
108+
}

0 commit comments

Comments
 (0)