add notebooks facebook page and finance-interest

This commit is contained in:
Chang CL
2025-12-07 15:09:39 +08:00
parent 4d873cd9e8
commit ab93ae3f1b
2 changed files with 134 additions and 0 deletions

86
FacebookPagePost.ipynb Normal file
View File

@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "51f39293-1c93-46f8-a32a-878c726866ae",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"curl -i -X GET \"https://graph.facebook.com/v24.0/oauth/access_token?grant_type=fb_exchange_token&client_id=4300871010148095&client_secret=af6db4c44e817e599f1df5e36b140d89&fb_exchange_token=EAA9HnpDI3v8BQG3AeYVip1t2PoIhvZA27jMrkDZBxbT9XV8AJVt2PGiS1lHlguigcFaqOj21NvWqZCkdVrKQQjh9PC4HoMnw2V1kUniSOEKXUu2v1CXd3mmijHcO7tsUsvmFxZBlZB9geSiD0TqJym0bKBVcptyOWv0JZA0GBhcI42Muzp0I6JumuuFQYcqiZBB29wj\"\n",
"\n",
"{\"id\":\"898811189972388_122105810781121964\"}\n"
]
}
],
"source": [
"#!/usr/bin/env python\n",
"# -*- coding: utf-8 -*-\n",
"\n",
"\"\"\"\n",
"Make Automated Posts to Facebook Page\n",
"\"\"\"\n",
"\n",
"import requests\n",
"\n",
"# Explorer\n",
"# https://developers.facebook.com/tools/explorer\n",
"\n",
"# Variables\n",
"version = 'v24.0'\n",
"\n",
"# Your App information\n",
"access_token = 'EAA9HnpDI3v8BPZB9gZBavZAGCjuSBTEJ0PxXVu1UxAAxAPF5GhDd3gG7grykwUktm9DrQn0Nf7Ov8fFZAttnT7fAhORKsxQvu7CC6IOXYfthmCLK7w7CejCSELZBTsHiIRRiWeqRdZA7yqqICy8sQuDLJKWKuNQIv1TcfOTlScDPi1knaqsHJz4JXelbUQKHX5gMnUkI04' # Add your Access Token\n",
"access_token_2 = 'EAA9HnpDI3v8BQG3AeYVip1t2PoIhvZA27jMrkDZBxbT9XV8AJVt2PGiS1lHlguigcFaqOj21NvWqZCkdVrKQQjh9PC4HoMnw2V1kUniSOEKXUu2v1CXd3mmijHcO7tsUsvmFxZBlZB9geSiD0TqJym0bKBVcptyOWv0JZA0GBhcI42Muzp0I6JumuuFQYcqiZBB29wj'\n",
"app_id = '4300871010148095' # Add your App ID\n",
"app_secret = 'af6db4c44e817e599f1df5e36b140d89' # Add your App secret\n",
"page_id = '898811189972388' # Add your Facebook Page ID\n",
"\n",
"# Get long token\n",
"print(f'''\n",
"curl -i -X GET \"https://graph.facebook.com/{version}/oauth/access_token?grant_type=fb_exchange_token&client_id={app_id}&client_secret={app_secret}&fb_exchange_token={access_token_2}\"\n",
"''')\n",
"\n",
"# To post text with a URL\n",
"my_url = 'https://workforcode.com/' # Add your URL\n",
"message = 'Hello World fix timeout error' # Update this with the text in your Facebook post\n",
"\n",
"baseurl = f'https://graph.facebook.com/{version}/{page_id}/feed'\n",
"payload = {\n",
" 'message': message,\n",
" 'link': my_url,\n",
" 'access_token': access_token_2\n",
"}\n",
"# Make Facebook post on your Page\n",
"# timeout error\n",
"res = requests.post(baseurl, data=payload, timeout=60)\n",
"print(res.text)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.12.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

48
Finance-Interest.ipynb Normal file
View File

@@ -0,0 +1,48 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "ebf454c3-d629-43e9-b9cc-34d306e89c23",
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'pandas'",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mModuleNotFoundError\u001b[39m Traceback (most recent call last)",
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mpandas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mpd\u001b[39;00m\n\u001b[32m 2\u001b[39m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mnumpy\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mas\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mnp\u001b[39;00m\n",
"\u001b[31mModuleNotFoundError\u001b[39m: No module named 'pandas'"
]
}
],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.12.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}