-
Notifications
You must be signed in to change notification settings - Fork 469
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d11a9a9
commit 7eea7ae
Showing
3 changed files
with
779 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,261 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "799abf9a-8d88-4180-8631-c9ffc9a6ba09", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"<img width=\"8%\" alt=\"Naas.png\" src=\"https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/.github/assets/logos/Naas.png\" style=\"border-radius: 15%\">" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "cbd9e219-f5dc-4a61-b928-e84cdb5ebf6d", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"# Pappers - Get association" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "5736ba95-73f8-4134-a550-ad2a2130a2bc", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Tags:** #pappers #api #python #data #association #information" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "76b44d58-5ce6-4769-b931-bb80ddfb9de4", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/florent-ravenel/)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ea3aff57-cfb8-40ae-8718-52f503306897", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Last update:** 2024-02-07 (Created: 2024-02-07)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "05e4744f-c9da-4363-a361-68a90415ddba", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**Description:** This notebook retrieves all available information about an association using the Pappers API. It demonstrates how to make API calls, handle responses and extract relevant data." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "e233c37e-8238-4974-b66d-2a2e671ee720", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"**References:**\n", | ||
"- [Pappers API Documentation](https://www.pappers.fr/api/documentation#operation/association)\n", | ||
"- [Python Requests Library](https://docs.python-requests.org/en/latest/)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8295289a-3be2-4669-85ba-9c8102105617", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Input" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "80096666-a5b9-43c1-9ddc-b0dbbebfc331", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Import libraries" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "cd66f8cf-be82-407b-a545-a3d38b633e94", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import requests\n", | ||
"import json" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "27b38d6a-1edf-4b83-ab9b-282bb8b8e6d6", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Setup variables\n", | ||
"- `api_key`: Your Pappers API key. You can get it from [here](https://www.pappers.fr/api/documentation#section/Introduction/Obtenir%20une%20cl%C3%A9%20API).\n", | ||
"- `association_id`: The ID of the association you want to get information about." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "865d01ba-f4aa-478c-88ed-887d0186889a", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"api_key = \"your_api_key\"\n", | ||
"association_id = \"your_association_id\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c248eee8-7f3e-4f6c-8562-0a6f6a9cdfd1", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Model" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "7e49a4e8-7787-409e-a7e3-16bf5be75b96", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Get Association Information" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "2a2a214f-c62b-42a2-ac18-c6a77a5c9008", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"This function makes a GET request to the Pappers API to retrieve information about the specified association. The response is a JSON object containing various details about the association." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5861c7f6-d47c-42d0-80fe-8898e42e6031", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"def get_association_info(api_key, association_id):\n", | ||
" url = (\n", | ||
" f\"https://api.pappers.fr/v2/association?id={association_id}&api_token={api_key}\"\n", | ||
" )\n", | ||
" response = requests.get(url)\n", | ||
" return response.json()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "bdd45eae-1dc2-4711-8c6c-f6143bf21f50", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## Output" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c74e4d40-6912-4c5e-9f87-a1e37673ea76", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"### Display result" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "479bff2b-ea07-4bfe-a7aa-2329eaad1489", | ||
"metadata": { | ||
"papermill": {}, | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"association_info = get_association_info(api_key, association_id)\n", | ||
"print(json.dumps(association_info, indent=4))" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.6" | ||
}, | ||
"widgets": { | ||
"application/vnd.jupyter.widget-state+json": { | ||
"state": {}, | ||
"version_major": 2, | ||
"version_minor": 0 | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.