|
25 | 25 | "import requests\n",
|
26 | 26 | "import random\n",
|
27 | 27 | "\n",
|
28 |
| - "# # Set API Keys and Authentification\n", |
29 |
| - "# logging.info('Setting NewsAPI API Key')\n", |
30 |
| - "# NEWSAPI_API_KEY = <your API key> # replace with own API key\n", |
| 28 | + "# Set API Keys and Authentification\n", |
| 29 | + "logging.info('Setting NewsAPI API Key')\n", |
| 30 | + "NEWSAPI_API_KEY = <your API key> # replace with own API key\n", |
31 | 31 | "\n",
|
32 |
| - "# logging.info('Setting OpenAI API Key')\n", |
33 |
| - "# openai.api_key = <your API key> # replace with own API key\n", |
| 32 | + "logging.info('Setting OpenAI API Key')\n", |
| 33 | + "openai.api_key = <your API key> # replace with own API key\n", |
34 | 34 | "\n",
|
35 |
| - "# logging.info('Setting Twitter API Key')\n", |
36 |
| - "# auth=tweepy.OAuthHandler(<your API key>,\n", |
37 |
| - "# <your API secret>)\n", |
38 |
| - "# auth.set_access_token(<your access token>,\n", |
39 |
| - "# <your access secret>)\n", |
40 |
| - "# twitter_api=tweepy.API(auth)\n", |
| 35 | + "logging.info('Setting Twitter API Key')\n", |
| 36 | + "auth=tweepy.OAuthHandler(<your API key>,\n", |
| 37 | + " <your API secret>)\n", |
| 38 | + "auth.set_access_token(<your access token>,\n", |
| 39 | + " <your access secret>)\n", |
| 40 | + "twitter_api=tweepy.API(auth)\n", |
41 | 41 | "\n",
|
42 | 42 | "CSV_NEWS_NAME = 'news_log.csv'\n",
|
43 | 43 | "CSV_FACTS_NAME = 'facts_log.csv'"
|
44 | 44 | ]
|
45 | 45 | },
|
46 |
| - { |
47 |
| - "cell_type": "code", |
48 |
| - "execution_count": 61, |
49 |
| - "metadata": {}, |
50 |
| - "outputs": [], |
51 |
| - "source": [ |
52 |
| - "from azure.identity import AzureCliCredential\n", |
53 |
| - "from azure.keyvault.secrets import SecretClient\n", |
54 |
| - "import tweepy\n", |
55 |
| - "from azure.storage.blob import BlobServiceClient\n", |
56 |
| - "import io\n", |
57 |
| - "import pandas as pd\n", |
58 |
| - "import openai\n", |
59 |
| - "\n", |
60 |
| - "\n", |
61 |
| - "# Set up the Azure Key Vault client and retrieve the Blob Storage account credentials\n", |
62 |
| - "keyvault_name = 'keyvaultforbot'\n", |
63 |
| - "client = SecretClient(f\"https://{keyvault_name}.vault.azure.net/\", AzureCliCredential())\n", |
64 |
| - "NEWSAPI_API_KEY = client.get_secret('newsapi-api-key').value\n", |
65 |
| - "#### Twitter Auth\n", |
66 |
| - "def twitter_auth():\n", |
67 |
| - " auth=tweepy.OAuthHandler(client.get_secret('twitter-api-key').value,\n", |
68 |
| - " client.get_secret('twitter-api-secret').value)\n", |
69 |
| - " auth.set_access_token(client.get_secret('twitter-access-token').value,\n", |
70 |
| - " client.get_secret('twitter-access-secret').value)\n", |
71 |
| - " twitter_api=tweepy.API(auth)\n", |
72 |
| - " logging.info('Twitter API ready')\n", |
73 |
| - " return twitter_api\n", |
74 |
| - "\n", |
75 |
| - "##### OpenAI API Key\n", |
76 |
| - "openai.api_key = client.get_secret('openai-api-key').value" |
77 |
| - ] |
78 |
| - }, |
79 | 46 | {
|
80 | 47 | "attachments": {},
|
81 | 48 | "cell_type": "markdown",
|
|
0 commit comments