Skip to content

Commit

Permalink
Merge pull request #2487 from jupyter-naas/2486-pipedrive-update-an-p…
Browse files Browse the repository at this point in the history
…erson-tipo-error

feat: add notes templates
  • Loading branch information
FlorentLvr authored Jan 5, 2024
2 parents 06d418a + ca45f3e commit e5e25b9
Show file tree
Hide file tree
Showing 5 changed files with 1,214 additions and 3 deletions.
291 changes: 291 additions & 0 deletions Pipedrive/Pipedrive_Get_a_note.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "71c0bc07-d10e-4777-9d07-f8069593b9dc",
"metadata": {
"papermill": {},
"tags": [
"naas"
]
},
"source": [
"<img width=\"8%\" alt=\"Pipedrive.png\" src=\"https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/.github/assets/logos/Pipedrive.png\" style=\"border-radius: 15%\">"
]
},
{
"cell_type": "markdown",
"id": "c2297c6c-1c56-44f5-ab1b-4f358315ae4d",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"# Pipedrive - Get details of a note\n",
"<a href=\"https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/Pipedrive/Pipedrive_Get_a_note.ipynb\" target=\"_parent\"><img src=\"https://naasai-public.s3.eu-west-3.amazonaws.com/Open_in_Naas_Lab.svg\"/></a><br><br><a href=\"https://bit.ly/3JyWIk6\">Give Feedback</a> | <a href=\"https://github.com/jupyter-naas/awesome-notebooks/issues/new?assignees=&labels=bug&template=bug_report.md&title=Pipedrive+-+Get+details+of+a+note:+Error+short+description\">Bug report</a>"
]
},
{
"cell_type": "markdown",
"id": "1528c23e-d4b5-4dae-aedd-3e0c3de7a07e",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Tags:** #pipedrive #note #get #snippet #api #v1 #python"
]
},
{
"cell_type": "markdown",
"id": "0f5b4999-cf8f-429b-a3b5-60abd6f0b4cb",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/florent-ravenel/)"
]
},
{
"cell_type": "markdown",
"id": "b50cf866-b0f5-45c1-9ea2-4c63d5622675",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Last update:** 2023-01-04 (Created: 2023-01-04)"
]
},
{
"cell_type": "markdown",
"id": "da21ae20-d8f3-41ae-b6e4-1d16e8bca2d0",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**Description:** This notebook returns the details of a note."
]
},
{
"cell_type": "markdown",
"id": "6a0004b2-eb12-4dc2-b721-6b482cab7439",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"**References:**\n",
"- [Pipedrive API v1 Documentation](https://developers.pipedrive.com/docs/api/v1/Notes#getNote)\n",
"- [Pipedrive API Authentication](https://developers.pipedrive.com/docs/api/authentication)\n",
"- [Get your Pipedrive API token](https://developers.pipedrive.com/docs/api/authentication)."
]
},
{
"cell_type": "markdown",
"id": "906e7461-ec7c-4efe-952b-79a2fcdf2b94",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Input"
]
},
{
"cell_type": "markdown",
"id": "699c6ed8-1d1c-4712-b64c-34ed8b385130",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Import libraries"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "771e3ddd-f295-4b44-a7d5-0873ee5be72a",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"import requests\n",
"import naas"
]
},
{
"cell_type": "markdown",
"id": "0ab0d130-cbec-438c-a188-8a0cb295da4e",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Setup variables\n",
"- `api_token`: API token used to authenticate the request.\n",
"- `object_id`: ID of the note."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d6ffb591-6b88-43f6-95b7-a93de4040366",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"api_token = naas.secret.get(\"PIPEDRIVE_API_KEY\") or \"YOUR_API_TOKEN\"\n",
"object_id = 3637"
]
},
{
"cell_type": "markdown",
"id": "61a6835b-4526-4d1e-9e21-e2c9325f0206",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Model"
]
},
{
"cell_type": "markdown",
"id": "35bdc814-3909-4188-94c0-0c1faf996c1e",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Get a note"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6810b2b3-de2c-4929-b2ff-f5d9c176ddbd",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"def get_note(api_token, object_id):\n",
" api_url = f'https://api.pipedrive.com/v1/notes/{object_id}?api_token={api_token}'\n",
" res = requests.get(api_url)\n",
" res.raise_for_status()\n",
" if res.status_code == 200:\n",
" return res.json()\n",
" else:\n",
" print(f'Failed to get organization with id {object_id}. Status code: {res.status_code}')\n",
" \n",
"result = get_note(api_token, object_id)\n",
"print(\"Note ID:\", result.get('data').get(\"id\"))\n",
"print(\"Note content:\", result.get('data').get(\"content\"))"
]
},
{
"cell_type": "markdown",
"id": "7c89f6ac-4231-46ea-81ba-3aa90bc46f3c",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"## Output"
]
},
{
"cell_type": "markdown",
"id": "ca89baa8-b76c-4f9e-8d60-74fdfacf141d",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4e6814d5-bfeb-413a-a4e9-7d9c70c4d95b",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": [
"result.get(\"data\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e26c07fc-63e7-475f-b4d6-91a4096f6bfc",
"metadata": {
"papermill": {},
"tags": []
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "5e625e87-9a42-44a4-a872-9ab557638886",
"metadata": {
"papermill": {},
"tags": []
},
"source": [
" "
]
}
],
"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"
},
"naas": {
"notebook_id": "ac0a2a8f823eaaec488085cbf985de5cceb467ba42d8856876fe0ecbcee2706a",
"notebook_path": "Pipedrive/Pipedrive_Get_a_person.ipynb"
},
"papermill": {
"default_parameters": {},
"environment_variables": {},
"parameters": {},
"version": "2.5.0"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit e5e25b9

Please sign in to comment.