diff --git a/.gitignore b/.gitignore index 9bea433..f63e47b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store +mlruns \ No newline at end of file diff --git a/resources/data-analysis/.env b/resources/data-analysis/.env new file mode 100644 index 0000000..74a0f64 --- /dev/null +++ b/resources/data-analysis/.env @@ -0,0 +1,6 @@ +AWS_ACCESS_KEY_ID=minio +AWS_SECRET_ACCESS_KEY=minio123 +MYSQL_DATABASE=mlflow_database +MYSQL_USER=mlflow_user +MYSQL_PASSWORD=mlflow +MYSQL_ROOT_PASSWORD=mysql \ No newline at end of file diff --git a/resources/data-analysis/docker-compose.yml b/resources/data-analysis/docker-compose.yml index 07b145e..07859be 100644 --- a/resources/data-analysis/docker-compose.yml +++ b/resources/data-analysis/docker-compose.yml @@ -27,3 +27,69 @@ services: SPARK_WORKER_CORES: 2 SPARK_WORKER_MEMORY: 2g SPARK_MASTER_URL: spark://spark-master:7077 + + + minio: + restart: always + image: minio/minio@sha256:b36dbf66046daa79a1cdc6b1a35e0e7724e3b12ee21d528c8952c30b7984c1bb + container_name: mlflow_s3 + ports: + - "9000:9000" + - "9001:9001" + command: server /data --console-address ':9001' --address ':9000' + environment: + - MINIO_ROOT_USER=${AWS_ACCESS_KEY_ID} + - MINIO_ROOT_PASSWORD=${AWS_SECRET_ACCESS_KEY} + volumes: + - minio_data:/data + + mc: + image: minio/mc@sha256:5ec8c7ed0aa3cde249d29d33e3790069581d9fb845a8ee2574662b7de8029abd + depends_on: + - minio + container_name: mc + env_file: + - .env + entrypoint: > + /bin/sh -c " + /tmp/wait-for-it.sh minio:9000 && + /usr/bin/mc alias set minio http://minio:9000 ${AWS_ACCESS_KEY_ID} ${AWS_SECRET_ACCESS_KEY} && + /usr/bin/mc mb minio/mlflow; + exit 0; + " + volumes: + - ./wait-for-it.sh:/tmp/wait-for-it.sh + + db: + restart: always + image: mysql/mysql-server@sha256:5b40d96b11333570143d98d3a74100fefadb9abb17b27a95dbc9ad33544ec142 + container_name: mlflow_db + ports: + - "3306:3306" + environment: + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + volumes: + - dbdata:/var/lib/mysql + + web: + restart: always + build: ./mlflow + image: mlflow_server + container_name: mlflow_server + depends_on: + - mc + - db + ports: + - "5000:5000" + environment: + - MLFLOW_S3_ENDPOINT_URL=http://minio:9000 + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} + - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} + command: mlflow server --backend-store-uri mysql+pymysql://${MYSQL_USER}:${MYSQL_PASSWORD}@db:3306/${MYSQL_DATABASE} --default-artifact-root s3://mlflow/ --host 0.0.0.0 + +volumes: + dbdata: + minio_data: \ No newline at end of file diff --git a/resources/data-analysis/f5-spark-analysis.ipynb b/resources/data-analysis/f5-spark-analysis.ipynb index 29e0836..59bbee3 100644 --- a/resources/data-analysis/f5-spark-analysis.ipynb +++ b/resources/data-analysis/f5-spark-analysis.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -56,7 +56,9 @@ "from pyspark.sql import SparkSession\n", "from pyspark.ml.feature import VectorAssembler\n", "from pyspark.ml.regression import LinearRegression\n", - "from pyspark.ml.evaluation import RegressionEvaluator" + "from pyspark.ml.evaluation import RegressionEvaluator\n", + "from datetime import datetime, timedelta\n", + "from pyspark.sql.types import *" ] }, { @@ -68,9 +70,53 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "ConnectionError", + "evalue": "HTTPConnectionPool(host='localhost', port=8200): Max retries exceeded with url: /v1/kv/data/f5.news (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mConnectionRefusedError\u001b[0m Traceback (most recent call last)", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:169\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 168\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 169\u001b[0m conn \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 170\u001b[0m \u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_dns_host\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mport\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mextra_kw\u001b[49m\n\u001b[1;32m 171\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 173\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m SocketTimeout:\n", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/util/connection.py:96\u001b[0m, in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[1;32m 95\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m err \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m---> 96\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m err\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m socket\u001b[38;5;241m.\u001b[39merror(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgetaddrinfo returns an empty list\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/util/connection.py:86\u001b[0m, in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[1;32m 85\u001b[0m sock\u001b[38;5;241m.\u001b[39mbind(source_address)\n\u001b[0;32m---> 86\u001b[0m \u001b[43msock\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43msa\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 87\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m sock\n", + "\u001b[0;31mConnectionRefusedError\u001b[0m: [Errno 111] Connection refused", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mNewConnectionError\u001b[0m Traceback (most recent call last)", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:700\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 699\u001b[0m \u001b[38;5;66;03m# Make the request on the httplib connection object.\u001b[39;00m\n\u001b[0;32m--> 700\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 701\u001b[0m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 702\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 703\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 704\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 706\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 707\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 708\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 710\u001b[0m \u001b[38;5;66;03m# If we're going to release the connection in ``finally:``, then\u001b[39;00m\n\u001b[1;32m 711\u001b[0m \u001b[38;5;66;03m# the response doesn't need to know about the connection. Otherwise\u001b[39;00m\n\u001b[1;32m 712\u001b[0m \u001b[38;5;66;03m# it will also try to release it and we'll have a double-release\u001b[39;00m\n\u001b[1;32m 713\u001b[0m \u001b[38;5;66;03m# mess.\u001b[39;00m\n", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:395\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 394\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 395\u001b[0m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mhttplib_request_kw\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 397\u001b[0m \u001b[38;5;66;03m# We are swallowing BrokenPipeError (errno.EPIPE) since the server is\u001b[39;00m\n\u001b[1;32m 398\u001b[0m \u001b[38;5;66;03m# legitimately able to close the connection after sending a valid response.\u001b[39;00m\n\u001b[1;32m 399\u001b[0m \u001b[38;5;66;03m# With this behaviour, the received response is still readable.\u001b[39;00m\n", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:234\u001b[0m, in \u001b[0;36mHTTPConnection.request\u001b[0;34m(self, method, url, body, headers)\u001b[0m\n\u001b[1;32m 233\u001b[0m headers[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUser-Agent\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m _get_default_user_agent()\n\u001b[0;32m--> 234\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mHTTPConnection\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/usr/lib/python3.10/http/client.py:1283\u001b[0m, in \u001b[0;36mHTTPConnection.request\u001b[0;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[1;32m 1282\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Send a complete request to the server.\"\"\"\u001b[39;00m\n\u001b[0;32m-> 1283\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencode_chunked\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/usr/lib/python3.10/http/client.py:1329\u001b[0m, in \u001b[0;36mHTTPConnection._send_request\u001b[0;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[1;32m 1328\u001b[0m body \u001b[38;5;241m=\u001b[39m _encode(body, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mbody\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m-> 1329\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mendheaders\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencode_chunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencode_chunked\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/usr/lib/python3.10/http/client.py:1278\u001b[0m, in \u001b[0;36mHTTPConnection.endheaders\u001b[0;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[1;32m 1277\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m CannotSendHeader()\n\u001b[0;32m-> 1278\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_output\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmessage_body\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencode_chunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mencode_chunked\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/usr/lib/python3.10/http/client.py:1038\u001b[0m, in \u001b[0;36mHTTPConnection._send_output\u001b[0;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[1;32m 1037\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer[:]\n\u001b[0;32m-> 1038\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmsg\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1040\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m message_body \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1041\u001b[0m \n\u001b[1;32m 1042\u001b[0m \u001b[38;5;66;03m# create a consistent interface to message_body\u001b[39;00m\n", + "File \u001b[0;32m/usr/lib/python3.10/http/client.py:976\u001b[0m, in \u001b[0;36mHTTPConnection.send\u001b[0;34m(self, data)\u001b[0m\n\u001b[1;32m 975\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mauto_open:\n\u001b[0;32m--> 976\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 977\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:200\u001b[0m, in \u001b[0;36mHTTPConnection.connect\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mconnect\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 200\u001b[0m conn \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_new_conn\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_prepare_conn(conn)\n", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:181\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 180\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m SocketError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m--> 181\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m NewConnectionError(\n\u001b[1;32m 182\u001b[0m \u001b[38;5;28mself\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFailed to establish a new connection: \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m e\n\u001b[1;32m 183\u001b[0m )\n\u001b[1;32m 185\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m conn\n", + "\u001b[0;31mNewConnectionError\u001b[0m: : Failed to establish a new connection: [Errno 111] Connection refused", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mMaxRetryError\u001b[0m Traceback (most recent call last)", + "File \u001b[0;32m~/.local/lib/python3.10/site-packages/requests/adapters.py:486\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 486\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 487\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 488\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 489\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 490\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 491\u001b[0m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 492\u001b[0m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 493\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 494\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 495\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 496\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 497\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 498\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 500\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:756\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 754\u001b[0m e \u001b[38;5;241m=\u001b[39m ProtocolError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConnection aborted.\u001b[39m\u001b[38;5;124m\"\u001b[39m, e)\n\u001b[0;32m--> 756\u001b[0m retries \u001b[38;5;241m=\u001b[39m \u001b[43mretries\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mincrement\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 757\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merror\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43me\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_stacktrace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msys\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexc_info\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 758\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 759\u001b[0m retries\u001b[38;5;241m.\u001b[39msleep()\n", + "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/util/retry.py:574\u001b[0m, in \u001b[0;36mRetry.increment\u001b[0;34m(self, method, url, response, error, _pool, _stacktrace)\u001b[0m\n\u001b[1;32m 573\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m new_retry\u001b[38;5;241m.\u001b[39mis_exhausted():\n\u001b[0;32m--> 574\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m MaxRetryError(_pool, url, error \u001b[38;5;129;01mor\u001b[39;00m ResponseError(cause))\n\u001b[1;32m 576\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIncremented Retry for (url=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m): \u001b[39m\u001b[38;5;132;01m%r\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, url, new_retry)\n", + "\u001b[0;31mMaxRetryError\u001b[0m: HTTPConnectionPool(host='localhost', port=8200): Max retries exceeded with url: /v1/kv/data/f5.news (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mConnectionError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[9], line 9\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m# print(client.is_authenticated())\u001b[39;00m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m----> 9\u001b[0m secret_resp \u001b[38;5;241m=\u001b[39m \u001b[43mclient\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msecrets\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkv\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mv2\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_secret_version\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 10\u001b[0m \u001b[43m \u001b[49m\u001b[43mmount_point\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mkv\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 11\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mf5.news\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 12\u001b[0m \u001b[43m \u001b[49m\u001b[43mraise_on_deleted_version\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\n\u001b[1;32m 13\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 15\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m secret_resp[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 16\u001b[0m secret_values \u001b[38;5;241m=\u001b[39m secret_resp[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m'\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m'\u001b[39m]\n", + "File \u001b[0;32m~/.local/lib/python3.10/site-packages/hvac/api/secrets_engines/kv_v2.py:153\u001b[0m, in \u001b[0;36mKvV2.read_secret_version\u001b[0;34m(self, path, version, mount_point, raise_on_deleted_version)\u001b[0m\n\u001b[1;32m 149\u001b[0m api_path \u001b[38;5;241m=\u001b[39m utils\u001b[38;5;241m.\u001b[39mformat_url(\n\u001b[1;32m 150\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/v1/\u001b[39m\u001b[38;5;132;01m{mount_point}\u001b[39;00m\u001b[38;5;124m/data/\u001b[39m\u001b[38;5;132;01m{path}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, mount_point\u001b[38;5;241m=\u001b[39mmount_point, path\u001b[38;5;241m=\u001b[39mpath\n\u001b[1;32m 151\u001b[0m )\n\u001b[1;32m 152\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 153\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_adapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 154\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mapi_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 155\u001b[0m \u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 156\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 157\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m exceptions\u001b[38;5;241m.\u001b[39mInvalidPath \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 158\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m raise_on_deleted_version:\n", + "File \u001b[0;32m~/.local/lib/python3.10/site-packages/hvac/adapters.py:146\u001b[0m, in \u001b[0;36mAdapter.get\u001b[0;34m(self, url, **kwargs)\u001b[0m\n\u001b[1;32m 135\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget\u001b[39m(\u001b[38;5;28mself\u001b[39m, url, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 136\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Performs a GET request.\u001b[39;00m\n\u001b[1;32m 137\u001b[0m \n\u001b[1;32m 138\u001b[0m \u001b[38;5;124;03m :param url: Partial URL path to send the request to. This will be joined to the end of the instance's base_uri\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[38;5;124;03m :rtype: requests.Response\u001b[39;00m\n\u001b[1;32m 145\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 146\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mget\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/.local/lib/python3.10/site-packages/hvac/adapters.py:408\u001b[0m, in \u001b[0;36mJSONAdapter.request\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 398\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrequest\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 399\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Main method for routing HTTP requests to the configured Vault base_uri.\u001b[39;00m\n\u001b[1;32m 400\u001b[0m \n\u001b[1;32m 401\u001b[0m \u001b[38;5;124;03m :param args: Positional arguments to pass to RawAdapter.request.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 406\u001b[0m \u001b[38;5;124;03m :rtype: dict | requests.Response\u001b[39;00m\n\u001b[1;32m 407\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 408\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 409\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response\u001b[38;5;241m.\u001b[39mstatus_code \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m200\u001b[39m:\n\u001b[1;32m 410\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + "File \u001b[0;32m~/.local/lib/python3.10/site-packages/hvac/adapters.py:367\u001b[0m, in \u001b[0;36mRawAdapter.request\u001b[0;34m(self, method, url, headers, raise_exception, **kwargs)\u001b[0m\n\u001b[1;32m 364\u001b[0m params\u001b[38;5;241m.\u001b[39mupdate({\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlist\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtrue\u001b[39m\u001b[38;5;124m\"\u001b[39m})\n\u001b[1;32m 365\u001b[0m _kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mparams\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m params\n\u001b[0;32m--> 367\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msession\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 368\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 369\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 370\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 371\u001b[0m \u001b[43m \u001b[49m\u001b[43mallow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mallow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 372\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43m_kwargs\u001b[49m\n\u001b[1;32m 373\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 375\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m response\u001b[38;5;241m.\u001b[39mok \u001b[38;5;129;01mand\u001b[39;00m (raise_exception \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mignore_exceptions):\n\u001b[1;32m 376\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_raise_for_error(method, url, response)\n", + "File \u001b[0;32m~/.local/lib/python3.10/site-packages/requests/sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[1;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[1;32m 587\u001b[0m }\n\u001b[1;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[0;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n", + "File \u001b[0;32m~/.local/lib/python3.10/site-packages/requests/sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[1;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43madapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[1;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n", + "File \u001b[0;32m~/.local/lib/python3.10/site-packages/requests/adapters.py:519\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 515\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(e\u001b[38;5;241m.\u001b[39mreason, _SSLError):\n\u001b[1;32m 516\u001b[0m \u001b[38;5;66;03m# This branch is for urllib3 v1.22 and later.\u001b[39;00m\n\u001b[1;32m 517\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m SSLError(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[0;32m--> 519\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[1;32m 521\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ClosedPoolError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 522\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(e, request\u001b[38;5;241m=\u001b[39mrequest)\n", + "\u001b[0;31mConnectionError\u001b[0m: HTTPConnectionPool(host='localhost', port=8200): Max retries exceeded with url: /v1/kv/data/f5.news (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))" + ] + } + ], "source": [ "client = hvac.Client(\n", " url=os.environ.get('VAULT_ADDR'),\n", @@ -109,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -127,13 +173,14 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "Successfully connected to MongoDB\n", "Joe Biden suddenly leads Donald Trump in multiple polls\n", "2024-03-12 13:44:05.327000\n", "42643 upvotes\n", @@ -162,6 +209,14 @@ "2024-03-08 06:49:05.200000\n", "26550 upvotes\n", "\n", + "Mike Johnson Completely Blindsided by Resignation in His Own Party: House Speaker Mike Johnson had no idea Representative Ken Buck is quitting, as the GOP is in complete shambles.\n", + "2024-03-13 14:44:05.491000\n", + "24690 upvotes\n", + "\n", + "Donald Trump stung as new poll shows how unpopular he is\n", + "2024-03-13 11:29:05.403000\n", + "23946 upvotes\n", + "\n", "Maddening New Poll: Voters Are Unaware of Trump “Dictator” Threats\n", "2024-03-06 11:44:05.362000\n", "23939 upvotes\n", @@ -174,9 +229,9 @@ "2024-03-07 13:49:05.605000\n", "23593 upvotes\n", "\n", - "Donald Trump stung as new poll shows how unpopular he is\n", - "2024-03-13 05:29:05.246000\n", - "22522 upvotes\n", + "“Can’t make it up”: Experts say transcript shows special counsel Robert Hur “lied” about Biden\n", + "2024-03-13 14:29:05.332000\n", + "22208 upvotes\n", "\n", "Trump loses bid to delay $83.3 million E. Jean Carroll judgment\n", "2024-03-08 15:14:05.220000\n", @@ -206,10 +261,6 @@ "2024-03-11 14:24:05.288000\n", "20501 upvotes\n", "\n", - "“Can’t make it up”: Experts say transcript shows special counsel Robert Hur “lied” about Biden\n", - "2024-03-13 05:29:05.246000\n", - "20397 upvotes\n", - "\n", "Donald Trump rages at Nikki Haley after losing Washington, D.C. primary\n", "2024-03-05 12:19:05.180000\n", "20066 upvotes\n", @@ -218,9 +269,9 @@ "2024-03-09 12:29:05.714000\n", "19870 upvotes\n", "\n", - "Mike Johnson Completely Blindsided by Resignation in His Own Party: House Speaker Mike Johnson had no idea Representative Ken Buck is quitting, as the GOP is in complete shambles.\n", - "2024-03-13 05:29:05.245000\n", - "18991 upvotes\n", + "Biden Transcript Calls Into Question Special Counsel’s Bombshell Memory Claims - The president was never even asked about the timing of his son’s death.\n", + "2024-03-13 14:24:05.952000\n", + "18997 upvotes\n", "\n", "Trump’s White House Was ‘Awash in Speed’ — and Xanax\n", "2024-03-04 20:14:05.352000\n", @@ -242,10 +293,6 @@ "2024-03-02 15:29:06.434000\n", "17869 upvotes\n", "\n", - "Biden Transcript Calls Into Question Special Counsel’s Bombshell Memory Claims - The president was never even asked about the timing of his son’s death.\n", - "2024-03-13 05:29:05.246000\n", - "17847 upvotes\n", - "\n", "Biden just delivered a State of the Union unlike anything we've seen before\n", "2024-03-09 22:49:05.997000\n", "17562 upvotes\n", @@ -302,6 +349,10 @@ "2024-03-03 21:04:05.274000\n", "14378 upvotes\n", "\n", + "Ken Buck teases more Republican resignations are coming\n", + "2024-03-13 18:54:05.530000\n", + "14200 upvotes\n", + "\n", "Moms for Liberty Is Slowly Imploding, and That’s Bad for MAGA in 2024\n", "2024-03-12 13:29:05.110000\n", "13759 upvotes\n", @@ -378,6 +429,10 @@ "2024-03-11 12:09:05.333000\n", "9217 upvotes\n", "\n", + "Robert Hur Admits Telling Biden He Seemed To Have 'Photographic Recall'\n", + "2024-03-13 14:34:05.230000\n", + "8877 upvotes\n", + "\n", "Trump is degenerating before our eyes — MAGA voters don't notice or don't care\n", "2024-03-07 11:59:05.201000\n", "8831 upvotes\n", @@ -446,22 +501,26 @@ "2024-03-12 11:49:05.530000\n", "7403 upvotes\n", "\n", + "Pete Buttigieg forced to explain that lead is poisonous to obtuse Republican. Drinking lead can damage people's brains, but Kansas Attorney General Kris Kobach opposes a plan to remove lead water pipes.\n", + "2024-03-13 14:14:05.033000\n", + "7393 upvotes\n", + "\n", + "Another Rising GOP Star Succumbs To Their Own Buffoonery\n", + "2024-03-13 10:49:06.228000\n", + "7389 upvotes\n", + "\n", "The courts were never going to save America from Donald Trump - No one is coming to save US democracy, except for ourselves.\n", "2024-03-03 14:54:05.281000\n", "7354 upvotes\n", "\n", - "Robert Hur Admits Telling Biden He Seemed To Have 'Photographic Recall'\n", - "2024-03-13 05:29:05.246000\n", - "7289 upvotes\n", + "“Trump Employee 5,” Fed Up With Judge Cannon, Dishes Dirt to CNN\n", + "2024-03-13 14:24:05.952000\n", + "7232 upvotes\n", "\n", "Biden on Britt’s SOTU response: ‘I thought she was a very talented woman’\n", "2024-03-11 15:59:06.666000\n", "7185 upvotes\n", "\n", - "Another Rising GOP Star Succumbs To Their Own Buffoonery\n", - "2024-03-13 05:29:05.246000\n", - "7129 upvotes\n", - "\n", "\"Truly dystopian\": Experts worry Trump's school vaccine plan will spark \"public health catastrophe\"\n", "2024-03-05 15:14:05.124000\n", "7039 upvotes\n", @@ -478,6 +537,10 @@ "2024-03-07 16:29:05.333000\n", "6858 upvotes\n", "\n", + "Biden Is Daring Republicans to Oppose Soaking the Rich\n", + "2024-03-13 08:29:05.477000\n", + "6828 upvotes\n", + "\n", "‘What the Hell Am I Watching’: Republicans Torch Their Own SOTU Rebuttal | Alabama Sen. Katie Britt was panned after delivering the most bizarre State of the Union rebuttal in recent memory\n", "2024-03-08 18:29:05.295000\n", "6801 upvotes\n", @@ -494,6 +557,14 @@ "2024-03-09 16:54:07.322000\n", "6638 upvotes\n", "\n", + "Republican Announces Abrupt Exit From Congress: ‘This Place Is Dysfunctional\n", + "2024-03-13 14:14:05.032000\n", + "6635 upvotes\n", + "\n", + "Katie Britt Blames Everyone but Herself in Shameless Fundraising Plea\n", + "2024-03-13 18:54:05.530000\n", + "6616 upvotes\n", + "\n", "The Supreme Court did Trump no favors. He’ll be facing a fall trial.\n", "2024-03-06 11:44:05.362000\n", "6599 upvotes\n", @@ -506,10 +577,6 @@ "2024-03-05 08:19:05.333000\n", "6528 upvotes\n", "\n", - "Biden Is Daring Republicans to Oppose Soaking the Rich\n", - "2024-03-13 03:19:04.993000\n", - "6524 upvotes\n", - "\n", "Majority of Americans had positive response to Biden’s SOTU speech: CNN poll\n", "2024-03-09 12:49:05.347000\n", "6507 upvotes\n", @@ -554,10 +621,6 @@ "2024-03-11 10:19:05.186000\n", "6040 upvotes\n", "\n", - "Pete Buttigieg forced to explain that lead is poisonous to obtuse Republican. Drinking lead can damage people's brains, but Kansas Attorney General Kris Kobach opposes a plan to remove lead water pipes.\n", - "2024-03-13 05:29:05.246000\n", - "6030 upvotes\n", - "\n", "Sen. Bernie Sanders: \"No more money to Netanyahu's war machine to kill Palestinian children\"\n", "2024-03-11 12:59:05.112000\n", "5932 upvotes\n", @@ -586,6 +649,10 @@ "2024-03-09 14:19:05.289000\n", "5821 upvotes\n", "\n", + "Biden special counsel Robert Hur’s resignation from DOJ makes his testimony “even more problematic”\n", + "2024-03-13 10:29:05.097000\n", + "5817 upvotes\n", + "\n", "Did Britt blame Biden for assault that happened during Bush Admin? Spokesman doesn’t say.\n", "2024-03-10 14:39:05.300000\n", "5780 upvotes\n", @@ -618,10 +685,6 @@ "2024-03-10 16:04:05.635000\n", "5634 upvotes\n", "\n", - "Biden special counsel Robert Hur’s resignation from DOJ makes his testimony “even more problematic”\n", - "2024-03-13 05:29:05.246000\n", - "5607 upvotes\n", - "\n", "“The Real White House Crime Family”: Dem Rep. Tells the GOP to Stop Wasting Time With Hunter Biden and Subpoena Jared Kushner - “Why did Saudi Arabia give Jared Kushner $2 billion—billion with a b—just months after he left the Trump White House?”\n", "2024-03-02 15:09:05.406000\n", "5553 upvotes\n", @@ -666,6 +729,10 @@ "2024-03-12 11:19:05.787000\n", "5257 upvotes\n", "\n", + "Poll Shows 74 Percent of Republicans Like Donald Trump’s Dictator Plan\n", + "2024-03-13 12:09:05.260000\n", + "5253 upvotes\n", + "\n", "Biden rebutter Sen. Britt blasted for recycling 20-year-old sex traffic story to attack border policy\n", "2024-03-10 14:24:05.285000\n", "5248 upvotes\n", @@ -678,6 +745,14 @@ "2024-03-02 14:49:05.207000\n", "5208 upvotes\n", "\n", + "‘Make The RNC White Again’: GOP Ends Minority Outreach Program\n", + "2024-03-13 18:54:05.530000\n", + "5197 upvotes\n", + "\n", + "Dems Kick Off High-Profile Hearing With Supercut of Trump’s Mental Gaffes\n", + "2024-03-13 11:19:05.444000\n", + "5151 upvotes\n", + "\n", "Johnson’s Hilarious SOTU Warning to House GOP Tells Us Everything - House Speaker Mike Johnson is reportedly begging Republicans to not act like total animals at the State of the Union.\n", "2024-03-08 11:49:06.559000\n", "5095 upvotes\n", @@ -686,9 +761,9 @@ "2024-03-09 16:54:07.322000\n", "5048 upvotes\n", "\n", - "Republican Announces Abrupt Exit From Congress: ‘This Place Is Dysfunctional\n", - "2024-03-13 05:29:05.246000\n", - "5018 upvotes\n", + "Trump’s GOP is already dying\n", + "2024-03-13 18:54:05.530000\n", + "4948 upvotes\n", "\n", "US supreme court ‘erred badly’ with Trump ruling, leading US historian says\n", "2024-03-06 11:04:05.927000\n", @@ -706,14 +781,6 @@ "2024-03-06 12:04:05.272000\n", "4865 upvotes\n", "\n", - "Dems Kick Off High-Profile Hearing With Supercut of Trump’s Mental Gaffes\n", - "2024-03-13 05:29:05.246000\n", - "4845 upvotes\n", - "\n", - "“Trump Employee 5,” Fed Up With Judge Cannon, Dishes Dirt to CNN\n", - "2024-03-13 05:29:05.246000\n", - "4820 upvotes\n", - "\n", "The Supreme Court Just Erased Part of the Constitution\n", "2024-03-05 16:44:05.581000\n", "4772 upvotes\n", @@ -734,10 +801,6 @@ "2024-03-08 15:09:05.160000\n", "4668 upvotes\n", "\n", - "Poll Shows 74 Percent of Republicans Like Donald Trump’s Dictator Plan\n", - "2024-03-13 05:29:05.246000\n", - "4654 upvotes\n", - "\n", "Biden to announce 'emergency' US military mission to build port off Gaza coast to deliver aid\n", "2024-03-08 10:29:05.679000\n", "4635 upvotes\n", @@ -786,6 +849,10 @@ "2024-03-10 04:29:05.015000\n", "4237 upvotes\n", "\n", + "E. Jean Carroll’s Lawyers Foil Trump’s Quiet Attempt to Stall $91 Million Payment\n", + "2024-03-13 14:39:05.192000\n", + "4234 upvotes\n", + "\n", "Thousands of millionaires haven’t filed tax returns for years, IRS says\n", "2024-03-02 18:19:05.676000\n", "4222 upvotes\n", @@ -810,6 +877,10 @@ "2024-03-06 14:44:05.256000\n", "4044 upvotes\n", "\n", + "Mar-a-Lago Witness Outs Himself Before Judge Cannon Can Do It For Him\n", + "2024-03-13 13:44:05.591000\n", + "4034 upvotes\n", + "\n", "Taylor Swift urges voters to the polls ahead of Super Tuesday\n", "2024-03-06 08:29:05.417000\n", "4030 upvotes\n", @@ -918,6 +989,10 @@ "2024-03-03 14:24:05.480000\n", "3679 upvotes\n", "\n", + "New polling shows female support for Trump has dropped\n", + "2024-03-13 12:24:05.317000\n", + "3667 upvotes\n", + "\n", "Biden Is Still the Democrats’ Best Bet for November\n", "2024-03-03 15:49:05.115000\n", "3662 upvotes\n", @@ -1026,6 +1101,10 @@ "2024-03-09 02:29:05.234000\n", "3101 upvotes\n", "\n", + "Trump Is Threatening to Gut Social Security. Take His Word for It.\n", + "2024-03-13 10:34:05.556000\n", + "3075 upvotes\n", + "\n", "Donald Trump endorses Mark Robinson, who said gays are ‘filth’ and ‘maggots,’ for NC governor. The former president said Sunday that the virulently anti-LGBTQ+ candidate is \"Martin Luther King on steroids” and \"better than Martin Luther King.\"\n", "2024-03-05 14:59:05.200000\n", "3048 upvotes\n", @@ -1042,6 +1121,10 @@ "2024-03-06 01:24:05.343000\n", "2990 upvotes\n", "\n", + "Republican Rep. Ken Buck is leaving Congress, further eroding GOP majority\n", + "2024-03-13 11:09:05.603000\n", + "2964 upvotes\n", + "\n", "A chunk of Republican primary and caucus voters say they wouldn’t vote for Trump as the GOP nominee\n", "2024-03-04 03:54:05.148000\n", "2963 upvotes\n", @@ -1054,6 +1137,10 @@ "2024-03-04 10:44:05.150000\n", "2940 upvotes\n", "\n", + "Trump tried to move assets to Florida, NY officials complain in fraud-judgment filing\n", + "2024-03-13 12:39:05.055000\n", + "2926 upvotes\n", + "\n", "Photos reveal Fani Willis' court nemesis campaigned for Nathan Wade\n", "2024-03-05 07:14:05.430000\n", "2903 upvotes\n", @@ -1066,6 +1153,14 @@ "2024-03-05 15:54:05.407000\n", "2887 upvotes\n", "\n", + "Haley Shaved 77K Votes Off Trump’s Georgia Win Despite Dropping Out\n", + "2024-03-13 18:54:05.530000\n", + "2880 upvotes\n", + "\n", + "Ron DeSantis’s Anti-LGBTQ Regime Is Crumbling\n", + "2024-03-13 18:54:05.530000\n", + "2877 upvotes\n", + "\n", "Greg Abbott's priorities questioned as record wildfires intensify in Texas\n", "2024-03-04 11:39:05.252000\n", "2809 upvotes\n", @@ -1082,10 +1177,6 @@ "2024-03-13 02:09:05.241000\n", "2798 upvotes\n", "\n", - "New polling shows female support for Trump has dropped\n", - "2024-03-13 05:29:05.246000\n", - "2791 upvotes\n", - "\n", "After Trump ballot ruling, critics say Supreme Court is selectively invoking conservative originalist approach\n", "2024-03-11 08:29:05.040000\n", "2777 upvotes\n", @@ -1094,18 +1185,10 @@ "2024-03-02 11:19:05.179000\n", "2773 upvotes\n", "\n", - "Trump Is Threatening to Gut Social Security. Take His Word for It.\n", - "2024-03-13 05:29:05.246000\n", - "2749 upvotes\n", - "\n", "FACT SHEET: President Biden Announces Plan to Lower Housing Costs for Working Families\n", "2024-03-08 10:39:05.293000\n", "2746 upvotes\n", "\n", - "Mar-a-Lago Witness Outs Himself Before Judge Cannon Can Do It For Him\n", - "2024-03-13 05:29:05.246000\n", - "2726 upvotes\n", - "\n", "Gov. Katie Hobbs to erase medical debt for 1M Arizonans with COVID relief funding\n", "2024-03-05 12:44:05.263000\n", "2724 upvotes\n", @@ -1114,9 +1197,9 @@ "2024-03-06 14:54:05.255000\n", "2714 upvotes\n", "\n", - "Republican Rep. Ken Buck is leaving Congress, further eroding GOP majority\n", - "2024-03-13 05:29:05.246000\n", - "2670 upvotes\n", + "Trump's RNC purge: His obsession with \"loyalty\" is as dumb as it is evil\n", + "2024-03-13 18:54:05.530000\n", + "2685 upvotes\n", "\n", "Sanders pushes harder for Gaza cease-fire: ‘Not another nickel for Netanyahu’\n", "2024-03-03 09:49:05.339000\n", @@ -1186,6 +1269,10 @@ "2024-03-09 14:19:05.289000\n", "2351 upvotes\n", "\n", + "Sen. Ossoff Introduces Bill Guaranteeing the Right to Vote For All Americans\n", + "2024-03-13 14:24:05.952000\n", + "2345 upvotes\n", + "\n", "Musk Increasingly Puts His Thumb on the Scale for Trump’s GOP\n", "2024-03-10 11:59:05.417000\n", "2336 upvotes\n", @@ -1218,6 +1305,10 @@ "2024-03-10 15:19:05.745000\n", "2263 upvotes\n", "\n", + "Alex Jones threatens Donald Trump\n", + "2024-03-13 10:49:06.228000\n", + "2218 upvotes\n", + "\n", "Former Texas GOP official handed over 400 years for child sexual abuse\n", "2024-03-13 01:49:05.229000\n", "2210 upvotes\n", @@ -1242,6 +1333,10 @@ "2024-03-10 03:59:05.824000\n", "2145 upvotes\n", "\n", + "Cheney has vowed that she’ll do whatever it takes to keep Trump from returning to the White House\n", + "2024-03-13 14:24:05.951000\n", + "2104 upvotes\n", + "\n", "Trump endorses Boebert: a ‘trusted America First Fighter’\n", "2024-03-03 16:34:05.672000\n", "2083 upvotes\n", @@ -1250,6 +1345,10 @@ "2024-03-04 23:59:05.204000\n", "2074 upvotes\n", "\n", + "Putin Says Donald Trump Discussed Presidential Election With Him\n", + "2024-03-13 17:44:05.557000\n", + "2061 upvotes\n", + "\n", "Donald Trump's string of gaffes over weekend raises eyebrows\n", "2024-03-11 15:24:05.297000\n", "2058 upvotes\n", @@ -1274,10 +1373,6 @@ "2024-03-02 13:24:05.437000\n", "1996 upvotes\n", "\n", - "Trump tried to move assets to Florida, NY officials complain in fraud-judgment filing\n", - "2024-03-13 05:29:05.246000\n", - "1991 upvotes\n", - "\n", "Fani Willis' Vile Trump Hate Mail Revealed in Court Papers\n", "2024-03-04 04:09:05.303000\n", "1973 upvotes\n", @@ -1334,6 +1429,10 @@ "2024-03-04 04:09:05.302000\n", "1843 upvotes\n", "\n", + "“Disturbing”: Experts alarmed after Judge Cannon “concerns” cause witness to complicate Trump case\n", + "2024-03-13 07:34:05.377000\n", + "1842 upvotes\n", + "\n", "Texas student suspended over his hair to attend SOTU as Congressional Black Caucus guest\n", "2024-03-08 06:29:05.263000\n", "1822 upvotes\n", @@ -1382,6 +1481,14 @@ "2024-03-07 11:34:05.409000\n", "1618 upvotes\n", "\n", + "Disinformation Is Tearing America Apart\n", + "2024-03-13 12:54:05.193000\n", + "1614 upvotes\n", + "\n", + "Conservatives are warning about noncitizens voting. It's a myth with a long history\n", + "2024-03-13 17:54:05.319000\n", + "1612 upvotes\n", + "\n", "Grisham on Trump’s meeting with Orbán: ‘He wants to be a dictator’\n", "2024-03-10 01:54:05.432000\n", "1599 upvotes\n", @@ -1414,14 +1521,18 @@ "2024-03-04 20:59:05.456000\n", "1467 upvotes\n", "\n", + "President Joe Biden has won enough delegates to clinch the 2024 Democratic nomination\n", + "2024-03-13 12:14:05.117000\n", + "1419 upvotes\n", + "\n", + "Rep. Lauren Boebert won’t pursue special election nomination to replace Rep. Ken Buck after his abrupt resignation\n", + "2024-03-13 18:54:05.530000\n", + "1416 upvotes\n", + "\n", "‘Its an invisible empire’: GOP gubernatorial candidate who said he had invitation for ‘honorary’ membership to join KKK kicked off ballot\n", "2024-03-03 03:34:05.368000\n", "1411 upvotes\n", "\n", - "“Disturbing”: Experts alarmed after Judge Cannon “concerns” cause witness to complicate Trump case\n", - "2024-03-13 03:14:05.206000\n", - "1401 upvotes\n", - "\n", "Biden campaign goes on attack over Trump allies' \"Project 2025\" vision\n", "2024-03-07 14:29:05.303000\n", "1375 upvotes\n", @@ -1474,9 +1585,9 @@ "2024-03-11 12:54:05.354000\n", "1315 upvotes\n", "\n", - "E. Jean Carroll’s Lawyers Foil Trump’s Quiet Attempt to Stall $91 Million Payment\n", - "2024-03-13 05:29:05.246000\n", - "1293 upvotes\n", + "Hillary Clinton says seniors should see Trump’s remarks on Social Security\n", + "2024-03-13 09:59:05.117000\n", + "1285 upvotes\n", "\n", "The stock market's strong year is a good sign for Biden's reelection hopes\n", "2024-03-04 12:44:06.345000\n", @@ -1534,6 +1645,10 @@ "2024-03-08 12:34:05.560000\n", "1144 upvotes\n", "\n", + "House passes TikTok crackdown that could ban app in U.S.\n", + "2024-03-13 18:49:05.789000\n", + "1139 upvotes\n", + "\n", "Biden says he regrets using term 'illegal,' as Trump hosts Laken Riley's family at rally\n", "2024-03-10 11:24:05.168000\n", "1118 upvotes\n", @@ -1582,6 +1697,10 @@ "2024-03-03 07:14:05.290000\n", "1073 upvotes\n", "\n", + "RNC hires election integrity lawyer who claims 2020 election was stolen\n", + "2024-03-13 17:44:05.557000\n", + "1066 upvotes\n", + "\n", "The world Nex Benedict deserved isn't hard to create. It just takes love and respect.\n", "2024-03-04 11:24:05.267000\n", "1065 upvotes\n", @@ -1646,6 +1765,10 @@ "2024-03-05 19:19:05.637000\n", "953 upvotes\n", "\n", + "GOP’s Impeachment Farce Is Imploding, and the Real Culprit Is Trump\n", + "2024-03-13 18:54:05.530000\n", + "922 upvotes\n", + "\n", "Katie Britt’s Strange Speech\n", "2024-03-09 17:39:05.584000\n", "922 upvotes\n", @@ -1654,6 +1777,10 @@ "2024-03-08 14:44:05.195000\n", "918 upvotes\n", "\n", + "“Judge Cannon has a lot to answer for”: Ex-Mueller prosecutor fumes after witness comes forward\n", + "2024-03-13 18:49:05.789000\n", + "906 upvotes\n", + "\n", "Trump won't give money to Ukraine if elected, says Hungarys Orban\n", "2024-03-11 16:09:05.767000\n", "901 upvotes\n", @@ -1666,6 +1793,10 @@ "2024-03-04 20:24:05.683000\n", "889 upvotes\n", "\n", + "Trump just floated Social Security cuts. Take him seriously.\n", + "2024-03-13 12:29:05.157000\n", + "885 upvotes\n", + "\n", "Trump asked Elon Musk if he wanted to buy Truth Social\n", "\n", "2024-03-12 13:19:05.313000\n", @@ -1691,13 +1822,9 @@ "2024-03-06 14:59:05.116000\n", "840 upvotes\n", "\n", - "Sen. Ossoff Introduces Bill Guaranteeing the Right to Vote For All Americans\n", - "2024-03-13 05:29:05.246000\n", - "838 upvotes\n", - "\n", - "President Joe Biden has won enough delegates to clinch the 2024 Democratic nomination\n", - "2024-03-13 05:29:05.246000\n", - "817 upvotes\n", + "Internet Abuzz Over Donald Trump's Autograph On Laken Riley Pic\n", + "2024-03-13 11:24:05.342000\n", + "821 upvotes\n", "\n", "Haley looks to beat expectations against Trump in Virginia\n", "2024-03-03 18:19:05.327000\n", @@ -1747,10 +1874,6 @@ "2024-03-04 17:04:05.265000\n", "627 upvotes\n", "\n", - "Disinformation Is Tearing America Apart\n", - "2024-03-13 05:29:05.246000\n", - "625 upvotes\n", - "\n", "Former Mar-a-Lago worker comes forward and describes moving materials in Trump classified docs case\n", "2024-03-12 10:14:05.271000\n", "615 upvotes\n", @@ -1867,6 +1990,10 @@ "2024-03-10 15:34:05.470000\n", "310 upvotes\n", "\n", + "Hunter Biden declines public hearing for House GOP impeachment inquiry | In a letter Wednesday, Biden’s attorney called the March 20 hearing a “blatant planned-for-media event” that is not a “proper proceeding.”\n", + "2024-03-13 18:19:05.325000\n", + "296 upvotes\n", + "\n", "Jill Biden puts Donald Trump on notice as her campaign role comes into focus | CNN Politics\n", "2024-03-03 12:09:05.217000\n", "286 upvotes\n", @@ -1891,6 +2018,10 @@ "2024-03-05 15:34:05.798000\n", "239 upvotes\n", "\n", + "Michigan lawmakers to propose revealing politicians’ ‘dark money’ accounts\n", + "2024-03-13 18:44:05.368000\n", + "237 upvotes\n", + "\n", "Trump meets with Hungary's leader, Viktor Orbán, continuing his embrace of autocrats\n", "2024-03-09 16:49:05.204000\n", "229 upvotes\n", @@ -1943,6 +2074,10 @@ "2024-03-11 18:54:05.436000\n", "201 upvotes\n", "\n", + "Michael Ian Black: Trump Will Blow Up America Just Like He Blew Up the RNC. | The ex-president’s idea of creative destruction lacks the part where you rebuild after you destroy.\n", + "2024-03-13 17:19:05.596000\n", + "200 upvotes\n", + "\n", "Warnock defends Fani Willis: ‘Never surprised’ by ‘Donald Trump attacking women, especially black women’\n", "2024-03-10 16:19:05.441000\n", "196 upvotes\n", @@ -1975,6 +2110,10 @@ "2024-03-06 19:24:05.683000\n", "183 upvotes\n", "\n", + "Vote against Trump, former supporters urge in $50m video campaign\n", + "2024-03-13 18:54:05.511000\n", + "182 upvotes\n", + "\n", "North Carolina GOP nominates Holocaust-denying, gay-bashing, extreme anti-abortion radical for Governor\n", "2024-03-06 14:39:05.496000\n", "181 upvotes\n", @@ -1983,10 +2122,6 @@ "2024-03-06 22:54:05.058000\n", "178 upvotes\n", "\n", - "Hillary Clinton says seniors should see Trump’s remarks on Social Security\n", - "2024-03-12 22:59:06.186000\n", - "176 upvotes\n", - "\n", "Statement from President Joe Biden Welcoming Sweden to NATO\n", "2024-03-12 00:14:05.167000\n", "176 upvotes\n", @@ -2023,10 +2158,6 @@ "2024-03-05 23:29:05.386000\n", "168 upvotes\n", "\n", - "Trump just floated Social Security cuts. Take him seriously.\n", - "2024-03-13 05:24:05.008000\n", - "167 upvotes\n", - "\n", "The hunt for the January 6 DC pipe bomber continues. Could a Congressional hearing unearth new information?\n", "2024-03-11 22:59:05.311000\n", "165 upvotes\n", @@ -2059,6 +2190,10 @@ "2024-03-06 16:19:05.787000\n", "160 upvotes\n", "\n", + "The Supreme Court granted Trump amnesty it has no power to give\n", + "2024-03-13 17:04:05.091000\n", + "156 upvotes\n", + "\n", "Fentanyl scanners at the border sit unused, with no money from Congress to install them\n", "2024-03-05 17:09:05.730000\n", "156 upvotes\n", @@ -2107,6 +2242,14 @@ "2024-03-04 22:19:05.842000\n", "148 upvotes\n", "\n", + "The Terrifying Christian Nationalist Crusade to Conquer America\n", + "2024-03-13 17:19:05.596000\n", + "147 upvotes\n", + "\n", + "Trump's new \"Honest Don\" nickname can't distract from his obvious decline\n", + "2024-03-13 15:44:05.390000\n", + "146 upvotes\n", + "\n", "Biden Administration Announces Urgent Security Assistance for Ukraine\n", "2024-03-13 01:04:05.251000\n", "146 upvotes\n", @@ -2144,6 +2287,10 @@ "2024-03-11 15:44:05.263000\n", "144 upvotes\n", "\n", + "Mike Johnson's GOP Retreat Flops as Republicans Skip Event\n", + "2024-03-13 13:39:05.432000\n", + "143 upvotes\n", + "\n", "How Newt Gingrich Laid the Groundwork for Trump's Republican Party\n", "2024-03-03 18:29:05.679000\n", "142 upvotes\n", @@ -2276,6 +2423,10 @@ "2024-03-08 21:09:05.530000\n", "121 upvotes\n", "\n", + "Polish leader presses Johnson on Ukraine aid: ‘Fate of millions of people’ depends on it\n", + "2024-03-13 16:49:05.268000\n", + "120 upvotes\n", + "\n", "Ken Buck Torches GOP After Declaring He’s Leaving Congress in Days\n", "2024-03-12 21:44:05.519000\n", "120 upvotes\n", @@ -2340,6 +2491,10 @@ "2024-03-05 01:39:05.166000\n", "115 upvotes\n", "\n", + "The federal judiciary just put a stop to ‘judge shopping’ for nationwide injunctions in divisions where only one friendly jurist sits\n", + "2024-03-13 18:54:05.511000\n", + "114 upvotes\n", + "\n", "Mark Robinson, the North Carolina GOP nominee for governor, is off the rails even by MAGA standards\n", "2024-03-07 13:24:06.965000\n", "114 upvotes\n", @@ -2352,6 +2507,10 @@ "2024-03-07 19:44:05.332000\n", "113 upvotes\n", "\n", + "Companies paid top executives more than they paid in US taxes\n", + "2024-03-13 13:34:05.231000\n", + "112 upvotes\n", + "\n", "Majority of Biden voters oppose weapons shipments to Israel, poll says\n", "2024-03-11 22:59:05.311000\n", "111 upvotes\n", @@ -2384,6 +2543,10 @@ "2024-03-05 20:59:05.342000\n", "110 upvotes\n", "\n", + "The voting bloc that could decide the US election: Swifties\n", + "2024-03-13 18:09:05.841000\n", + "108 upvotes\n", + "\n", "Perjury Plea Opens Up Trump Lawyers to Big Problems - Donald Trump’s former money man Allen Weisselberg pleaded guilty to perjury. Now, his lawyers could be on the hook for Weisselberg’s lies. And it could affect Trump’s own defense.\n", "2024-03-06 21:29:05.678000\n", "108 upvotes\n", @@ -2444,10 +2607,6 @@ "2024-03-04 21:24:05.242000\n", "104 upvotes\n", "\n", - "Internet Abuzz Over Donald Trump's Autograph On Laken Riley Pic\n", - "2024-03-13 02:54:05.075000\n", - "103 upvotes\n", - "\n", "Trump says one of his first actions would be freeing imprisoned Jan. 6 rioters\n", "2024-03-12 04:34:05.454000\n", "103 upvotes\n", @@ -2472,6 +2631,10 @@ "2024-03-06 19:14:05.262000\n", "103 upvotes\n", "\n", + "Trump Hit With Harsh Truth After Harsh Truth From Former Voters In Scathing Ads\n", + "2024-03-13 15:44:05.390000\n", + "102 upvotes\n", + "\n", "Missouri: home to child marriage, corporal punishment and sick ‘child welfare’ ideas. Missouri lawmakers – great defenders of children! – want to force teachers to register as sex offenders if they use a trans child’s preferred pronouns\n", "2024-03-10 19:14:06.145000\n", "102 upvotes\n", @@ -2608,6 +2771,10 @@ "2024-03-06 17:54:05.298000\n", "93 upvotes\n", "\n", + "House passes bill that could ban TikTok in the U.S., sending it to the Senate\n", + "2024-03-13 16:09:05.277000\n", + "92 upvotes\n", + "\n", "Hogan: Trump push against bipartisan border bill made me ‘angry enough’ to run for Senate\n", "2024-03-04 22:44:05.597000\n", "92 upvotes\n", @@ -2616,10 +2783,6 @@ "2024-03-13 00:09:05.128000\n", "91 upvotes\n", "\n", - "Alex Jones threatens Donald Trump\n", - "2024-03-12 21:04:05.415000\n", - "91 upvotes\n", - "\n", "Sex trafficking survivor slams Britt for inaccurate story in SOTU response\n", "2024-03-11 17:19:05.191000\n", "91 upvotes\n", @@ -2676,6 +2839,10 @@ "2024-03-01 22:49:05.614000\n", "89 upvotes\n", "\n", + "House passes bill that could ban TikTok despite resistance from Trump\n", + "2024-03-13 16:24:05.141000\n", + "88 upvotes\n", + "\n", "Supreme Court deals blow to Greg Abbott's border plans\n", "2024-03-12 16:54:05.415000\n", "88 upvotes\n", @@ -2780,6 +2947,10 @@ "2024-03-04 16:34:05.219000\n", "83 upvotes\n", "\n", + "The Simple Reason Trump Is Suddenly Defending TikTok: The president thinks backing the embattled short-form video app will help him and his rich friends.\n", + "2024-03-13 14:54:05.770000\n", + "82 upvotes\n", + "\n", "How Trump’s Justice Dept. Derailed an Investigation of a Major Company\n", "2024-03-09 19:49:06.167000\n", "82 upvotes\n", @@ -2980,6 +3151,10 @@ "2024-03-06 14:09:05.254000\n", "75 upvotes\n", "\n", + "RNC’s New “Election Integrity” Specialist Ought to Scare You - Christina Bobb is a notorious election denier. And the Republican National Committee wants her help.\n", + "2024-03-13 18:54:05.511000\n", + "74 upvotes\n", + "\n", "Republican Rep. Ken Buck to leave Congress next week, narrowing GOP’s slim majority\n", "2024-03-12 23:29:05.149000\n", "74 upvotes\n", @@ -3100,6 +3275,10 @@ "2024-03-06 02:54:05.595000\n", "72 upvotes\n", "\n", + "House GOP launches new probe of Jan. 6 and tries shifting blame for Capitol attack away from Trump\n", + "2024-03-13 12:49:05.274000\n", + "71 upvotes\n", + "\n", "‘Never Means Never’: A ‘Never Trump’ Republican on Where The Movement Goes Next\n", "2024-03-06 04:29:05.561000\n", "71 upvotes\n", @@ -3136,6 +3315,10 @@ "2024-03-05 14:14:05.216000\n", "70 upvotes\n", "\n", + "Republicans’ House majority is their smallest in decades, and shrinking\n", + "2024-03-13 17:44:05.556000\n", + "69 upvotes\n", + "\n", "President Joe Biden clinched the Democratic presidential nomination with a decisive victory in swing-state Georgia\n", "2024-03-13 00:59:05.149000\n", "69 upvotes\n", @@ -3272,6 +3455,10 @@ "2024-03-03 14:39:05.399000\n", "66 upvotes\n", "\n", + "Congress’ failure so far to deliver on promise of tens of billions in new research spending threatens America’s long-term economic competitiveness\n", + "2024-03-13 17:49:05.339000\n", + "65 upvotes\n", + "\n", "Rep. Ken Buck will resign from Congress by end of next week\n", "2024-03-12 19:44:05.284000\n", "65 upvotes\n", @@ -3416,6 +3603,10 @@ "2024-03-02 17:09:05.710000\n", "62 upvotes\n", "\n", + "A small city in Oklahoma elected a white nationalist. Will it be able to vote him out?\n", + "2024-03-13 18:54:05.511000\n", + "61 upvotes\n", + "\n", "Putin and Trump – from bad to worse\n", "2024-03-08 20:49:05.178000\n", "61 upvotes\n", @@ -3440,6 +3631,10 @@ "2024-03-04 19:29:05.231000\n", "61 upvotes\n", "\n", + "GOP Senate Candidate Took Bold Stance Against the Sale of Alcohol… In Wisconsin\n", + "2024-03-13 17:09:05.152000\n", + "60 upvotes\n", + "\n", "‘Young and handsome’: Biden kicks off $30m ad blitz with spot addressing age\n", "2024-03-10 01:19:05.704000\n", "60 upvotes\n", @@ -3548,6 +3743,10 @@ "2024-03-03 02:09:05.263000\n", "57 upvotes\n", "\n", + "Democratic Senators Urge Biden to Stop Arming Israel\n", + "2024-03-13 16:14:05.580000\n", + "56 upvotes\n", + "\n", "Europe is unprepared for risks from Russia and Trump, says Airbus boss\n", "2024-03-12 01:34:05.302000\n", "56 upvotes\n", @@ -3668,6 +3867,22 @@ "2024-03-03 19:24:05.212000\n", "54 upvotes\n", "\n", + "Anti-LGBTQ+ hate crimes in schools have quadrupled in states with laws targeting the community. “The data you have is the thing I’ve been worrying about,\" one expert said.\n", + "2024-03-13 18:54:05.511000\n", + "53 upvotes\n", + "\n", + "How Buck’s early retirement is a problem for Boebert\n", + "2024-03-13 17:29:06.174000\n", + "53 upvotes\n", + "\n", + "Former Pentagon chief Esper says Trump wanted to shoot protesters\n", + "2024-03-13 13:19:05.812000\n", + "53 upvotes\n", + "\n", + "Democrats go on offense as Trump floats Social Security cuts\n", + "2024-03-13 11:49:05.079000\n", + "53 upvotes\n", + "\n", "Which Supreme Court justices threw Trump the immunity lifeline?\n", "2024-03-11 17:24:05.515000\n", "53 upvotes\n", @@ -3888,6 +4103,10 @@ "2024-03-01 23:04:05.210000\n", "47 upvotes\n", "\n", + "Anti-Abortion Activists Have Republicans in a Vise\n", + "2024-03-13 05:44:07.239000\n", + "46 upvotes\n", + "\n", "Ron DeSantis’s next chapter in book bans backlash? Blame someone else\n", "2024-03-12 19:44:05.284000\n", "46 upvotes\n", @@ -3917,6 +4136,10 @@ "2024-03-01 23:14:05.266000\n", "46 upvotes\n", "\n", + "Judge overseeing Georgia election interference case dismisses some of charges against Trump\n", + "2024-03-13 15:44:05.390000\n", + "45 upvotes\n", + "\n", "Adam Schiff says Katie Porter ‘congratulated’ him despite calling California Senate race ‘rigged’\n", "2024-03-13 00:24:05.311000\n", "45 upvotes\n", @@ -4033,6 +4256,10 @@ "2024-03-02 17:29:05.212000\n", "43 upvotes\n", "\n", + "Why Trump Might Cut Social Security and Medicare in a Second Term\n", + "2024-03-13 06:14:05.538000\n", + "42 upvotes\n", + "\n", "Congress, sleep experts at odds over permanent daylight saving time\n", "2024-03-12 14:49:05.282000\n", "42 upvotes\n", @@ -4065,6 +4292,14 @@ "2024-03-02 16:44:05.304000\n", "42 upvotes\n", "\n", + "TikTok ban: House votes for bill that requires app to be sold or blocked\n", + "2024-03-13 15:59:05.256000\n", + "41 upvotes\n", + "\n", + "US VP Harris Gathers Fat Joe and People Pardoned for Marijuana Convictions to Discuss Reforms\n", + "2024-03-13 15:24:05.585000\n", + "41 upvotes\n", + "\n", "Mexico got rid of daylight saving time. Should the U.S. end it, too?\n", "2024-03-12 05:34:05.228000\n", "41 upvotes\n", @@ -4101,6 +4336,10 @@ "2024-03-04 08:39:05.317000\n", "41 upvotes\n", "\n", + "Judge dismisses some Trump Georgia election subversion charges but leaves most of the case intact \n", + "2024-03-13 15:59:05.256000\n", + "40 upvotes\n", + "\n", "Netanyahu vows to defy Biden’s ‘red line’ and invade Rafah\n", "2024-03-10 20:39:05.872000\n", "40 upvotes\n", @@ -4161,8 +4400,8 @@ "2024-03-01 22:29:05.582000\n", "40 upvotes\n", "\n", - "Anti-Abortion Activists Have Republicans in a Vise\n", - "2024-03-13 05:29:05.245000\n", + "House considers dueling discharge petitions to force foreign aid vote\n", + "2024-03-13 18:44:05.369000\n", "39 upvotes\n", "\n", "How LGBTQ+ advocates secured a victory against Florida's 'don't say gay' law\n", @@ -4213,6 +4452,14 @@ "2024-03-02 17:39:06.230000\n", "39 upvotes\n", "\n", + "Trump Appeases Putin, Republican Russia Hawks Appease Trump. Viktor Orban admits Trump’s “peace plan” is to let Russia win.\n", + "2024-03-13 18:54:05.511000\n", + "38 upvotes\n", + "\n", + "'It means a lot:' LGBTQ+ advocates claim victory in 'Don't Say Gay' education settlement: Florida Department of Education must clarify what can and can't be discussed in classrooms\n", + "2024-03-13 15:54:06.095000\n", + "38 upvotes\n", + "\n", "Could Trump lose his Wall Street ‘favourite’ as legal woes threaten business empire?\n", "2024-03-12 18:59:05.091000\n", "38 upvotes\n", @@ -4249,6 +4496,10 @@ "2024-03-03 19:39:06.128000\n", "38 upvotes\n", "\n", + "You can apply for the American Climate Corps next month\n", + "2024-03-13 16:24:05.141000\n", + "37 upvotes\n", + "\n", "Try to Make Any Sense of What Trump Says About TikTok Here\n", "2024-03-11 19:24:05.233000\n", "37 upvotes\n", @@ -4521,6 +4772,10 @@ "2024-03-03 14:39:05.399000\n", "33 upvotes\n", "\n", + "Democrats plead with Johnson to put Ukraine bill on floor: ‘Lead, follow or get out of the way’\n", + "2024-03-13 18:54:05.510000\n", + "32 upvotes\n", + "\n", "Unions in Maryland rally in Annapolis to advocate for labor-friendly legislature\n", "2024-03-12 17:44:05.372000\n", "32 upvotes\n", @@ -4557,6 +4812,10 @@ "2024-03-04 22:49:05.854000\n", "32 upvotes\n", "\n", + "US House passes bill to force ByteDance to divest TikTok or face ban\n", + "2024-03-13 16:49:05.269000\n", + "31 upvotes\n", + "\n", "GOP’s Ron Johnson sees focus on governance as ‘almost code words’\n", "2024-03-12 19:49:06.091000\n", "31 upvotes\n", @@ -4589,6 +4848,10 @@ "2024-03-03 03:24:05.326000\n", "31 upvotes\n", "\n", + "Man sentenced to prison in bomb threat to Arizona election official\n", + "2024-03-13 17:04:05.092000\n", + "30 upvotes\n", + "\n", "Rep. Jamie Raskin criticized a House Judiciary Committee hearing on Tuesday about a report on President Biden’s handling of classified documents.\n", "2024-03-12 22:49:05.122000\n", "30 upvotes\n", @@ -4733,6 +4996,10 @@ "2024-03-03 01:19:05.585000\n", "29 upvotes\n", "\n", + "Jerome Powell just revealed a hidden reason why inflation is staying high: The economy is increasingly uninsurable\n", + "2024-03-13 16:49:05.269000\n", + "28 upvotes\n", + "\n", "Trump says pardoning Capitol attackers will be one of his first acts if elected again\n", "2024-03-12 20:14:05.521000\n", "28 upvotes\n", @@ -4785,10 +5052,6 @@ "2024-03-02 19:39:06.388000\n", "28 upvotes\n", "\n", - "Why Trump Might Cut Social Security and Medicare in a Second Term\n", - "2024-03-13 05:29:05.245000\n", - "27 upvotes\n", - "\n", "The California Senate race wasn’t ‘rigged’ either\n", "2024-03-12 18:54:05.186000\n", "27 upvotes\n", @@ -4849,6 +5112,10 @@ "2024-03-02 14:24:05.209000\n", "27 upvotes\n", "\n", + "Trump's RNC makeover signals his plans for 2025\n", + "2024-03-13 11:39:05.122000\n", + "26 upvotes\n", + "\n", "Texas judge blocks AG’s subpoena of migrant nonprofit\n", "2024-03-12 06:24:05.166000\n", "26 upvotes\n", @@ -4925,6 +5192,14 @@ "2024-03-02 17:24:05.170000\n", "25 upvotes\n", "\n", + "Arkansas stops offering ‘X’ as an alternative to male and female on state IDs | Arkansans have had the option to use “X” on state-issued driver's licenses and identification cards since 2010.\n", + "2024-03-13 15:59:05.256000\n", + "24 upvotes\n", + "\n", + "Hur transcript shows nuance of Beau Biden exchange\n", + "2024-03-13 13:59:05.530000\n", + "24 upvotes\n", + "\n", "‘Bullies’: Biden effigy showcases a Johnson County Republican Party shaped by Trump era\n", "2024-03-12 06:09:05.045000\n", "24 upvotes\n", @@ -4997,6 +5272,10 @@ "2024-03-02 00:24:05.358000\n", "24 upvotes\n", "\n", + "DHS officials’ texts show unfiltered reaction to January 6\n", + "2024-03-13 18:54:05.511000\n", + "23 upvotes\n", + "\n", "NY Republicans have an early voting problem. Could that spell trouble in 2024?\n", "2024-03-12 14:39:05.319000\n", "23 upvotes\n", @@ -5085,6 +5364,10 @@ "2024-03-02 00:24:05.358000\n", "23 upvotes\n", "\n", + "CNN Anchor Makes GOP Rep Flail With Brutal Fact Check\n", + "2024-03-13 18:39:05.589000\n", + "22 upvotes\n", + "\n", "Primaries Show Candidates Can Win on TikTok But Lose at the Polls\n", "2024-03-12 15:19:05.602000\n", "22 upvotes\n", @@ -5197,6 +5480,22 @@ "2024-03-01 22:19:05.946000\n", "21 upvotes\n", "\n", + "House passes bill that could lead to a TikTok ban; fight shifts to the Senate\n", + "2024-03-13 18:34:05.248000\n", + "20 upvotes\n", + "\n", + "US House passes bill cracking down on TikTok\n", + "2024-03-13 17:09:05.153000\n", + "20 upvotes\n", + "\n", + "Judge Quashes Six Charges in Georgia Election Case Against Trump\n", + "2024-03-13 16:29:05.184000\n", + "20 upvotes\n", + "\n", + "House is likely to pass a bill that could ban TikTok, but it faces an uncertain path in the Senate\n", + "2024-03-13 12:29:05.156000\n", + "20 upvotes\n", + "\n", "Ron Klain Thinks The Biden ‘Alliance’ Is Strong Enough To Withstand Gaza And Trump\n", "2024-03-13 04:39:05.346000\n", "20 upvotes\n", @@ -5265,6 +5564,14 @@ "2024-03-02 17:19:05.232000\n", "20 upvotes\n", "\n", + "Judge dismisses some charges against Trump in the Georgia 2020 election interference case\n", + "2024-03-13 17:44:05.556000\n", + "19 upvotes\n", + "\n", + "Trump says abortion is a top concern for him, , viewing the issue as a potential vulnerability for Republicans.\n", + "2024-03-13 13:34:05.231000\n", + "19 upvotes\n", + "\n", "Republicans Go To Bat For Federal Prisoner Who Testified In Biden Impeachment Inquiry\n", "2024-03-10 19:44:05.581000\n", "19 upvotes\n", @@ -5329,6 +5636,10 @@ "2024-03-01 23:19:05.224000\n", "19 upvotes\n", "\n", + "Arkansas stops offering 'X' as an alternative to male and female on driver's licenses and IDs\n", + "2024-03-13 06:24:05.455000\n", + "18 upvotes\n", + "\n", "States threaten to sue Maine over 'unprecendented' transgender care bill\n", "2024-03-13 04:39:05.346000\n", "18 upvotes\n", @@ -5401,6 +5712,10 @@ "2024-03-01 23:34:05.379000\n", "18 upvotes\n", "\n", + "Judge dismisses some charges against Trump in the Georgia 2020 election interference case\n", + "2024-03-13 16:34:05.545000\n", + "17 upvotes\n", + "\n", "DeSantis, LGBTQ plaintiffs settle ‘Don’t Say Gay’ school lawsuit\n", "2024-03-12 01:04:05.372000\n", "17 upvotes\n", @@ -5461,6 +5776,10 @@ "2024-03-02 16:49:05.367000\n", "17 upvotes\n", "\n", + "Republican senators reveal their version of Kentucky's next two-year budget\n", + "2024-03-13 18:54:05.511000\n", + "16 upvotes\n", + "\n", "r/Politics' 2024 US Elections Live Thread, Part 4\n", "2024-03-13 01:19:05.426000\n", "16 upvotes\n", @@ -5685,6 +6004,14 @@ "2024-03-02 08:44:05.334000\n", "14 upvotes\n", "\n", + "Georgia Judge Dismisses Charges Related to Trump’s Call to ‘Find’ Votes\n", + "2024-03-13 16:34:05.545000\n", + "13 upvotes\n", + "\n", + "Georgia judge drops six charges against Trump and co-defendants in election interference case\n", + "2024-03-13 16:19:05.459000\n", + "13 upvotes\n", + "\n", "Biden and Trump could clinch nominations in Tuesday's contests, ushering in general election\n", "2024-03-12 16:44:06.032000\n", "13 upvotes\n", @@ -5757,6 +6084,14 @@ "2024-03-02 17:34:07.430000\n", "13 upvotes\n", "\n", + "TikTok ban's fate is uncertain in the Senate, where there is less urgency to act\n", + "2024-03-13 17:29:06.174000\n", + "12 upvotes\n", + "\n", + "Judge tosses some Trump Georgia charges in election interference case\n", + "2024-03-13 16:24:05.141000\n", + "12 upvotes\n", + "\n", "Congressional hearing on the Biden classified documents probe turns into a proxy campaign battle\n", "2024-03-12 20:39:05.710000\n", "12 upvotes\n", @@ -5841,6 +6176,18 @@ "2024-03-03 20:54:05.133000\n", "12 upvotes\n", "\n", + "George W. Bush ‘Didn’t Care’ When People Made Fun of Him as President, Jenna Bush Hager Says: ‘He Loved It’\n", + "2024-03-13 18:54:05.511000\n", + "11 upvotes\n", + "\n", + "Biden and Trump clinch nominations, sealing presidential rematch in 2024 election\n", + "2024-03-13 17:19:05.597000\n", + "11 upvotes\n", + "\n", + "Judge Overseeing Georgia Election Interference Case Dismisses Some Charges Against Trump\n", + "2024-03-13 16:19:05.458000\n", + "11 upvotes\n", + "\n", "Ballot measures shape debates on hot-button issues, drawing millions in outside spending\n", "2024-03-13 00:49:05.010000\n", "11 upvotes\n", @@ -5901,6 +6248,18 @@ "2024-03-02 22:14:05.457000\n", "11 upvotes\n", "\n", + "Judge overseeing Georgia election interference case dismisses some charges against Trump\n", + "2024-03-13 18:54:05.511000\n", + "10 upvotes\n", + "\n", + "Congress could ban TikTok. Here’s how Florida House members just voted.\n", + "2024-03-13 17:24:07.093000\n", + "10 upvotes\n", + "\n", + "America’s election chiefs are worried AI is coming for them | Election officials are important enough to fake — and public enough to make it easy to do — but anonymous enough that voters may easily be tricked\n", + "2024-03-13 08:54:05.499000\n", + "10 upvotes\n", + "\n", "Biden and Trump become 2024's presumptive nominees as rematch kicks off\n", "2024-03-13 04:49:05.501000\n", "10 upvotes\n", @@ -6105,6 +6464,10 @@ "2024-03-02 12:09:08.717000\n", "8 upvotes\n", "\n", + "Steve Kornacki maps the road to 270 at start of the campaign\n", + "2024-03-13 16:49:05.269000\n", + "7 upvotes\n", + "\n", "Nancy Mace spars with George Stephanopoulos about Trump\n", "2024-03-10 17:59:05.458000\n", "7 upvotes\n", @@ -6161,6 +6524,22 @@ "2024-03-02 06:54:05.192000\n", "7 upvotes\n", "\n", + "Judge in Georgia election interference case quashes some charges against Trump\n", + "2024-03-13 18:34:05.248000\n", + "6 upvotes\n", + "\n", + "Judge in Georgia election case dismisses six charges against Trump and others\n", + "2024-03-13 18:14:05.305000\n", + "6 upvotes\n", + "\n", + "Ted Cruz's NIL roundtable raises important issues, but misses the point\n", + "2024-03-13 17:29:06.175000\n", + "6 upvotes\n", + "\n", + "Georgia judge dismisses some charges in Trump 2020 election case\n", + "2024-03-13 15:29:05.308000\n", + "6 upvotes\n", + "\n", "Google restricts election-related queries for its Gemini chatbot\n", "2024-03-12 23:04:06.286000\n", "6 upvotes\n", @@ -6217,6 +6596,26 @@ "2024-03-04 09:34:04.988000\n", "6 upvotes\n", "\n", + "O'Neill and Little-Pengelly fly to US for St Patrick's Biden meeting\n", + "2024-03-13 18:54:05.511000\n", + "5 upvotes\n", + "\n", + "Environment, climate policies mostly took a backseat during Oregon’s 2024 short session\n", + "2024-03-13 18:44:05.369000\n", + "5 upvotes\n", + "\n", + "The US has its first presidential rematch since 1956, and other facts about the Biden-Trump sequel\n", + "2024-03-13 15:14:05.642000\n", + "5 upvotes\n", + "\n", + "The billionaire’s guide to doing taxes\n", + "2024-03-13 15:09:06.442000\n", + "5 upvotes\n", + "\n", + "Biden, Trump clinch nominations, kicking off bruising presidential rematch\n", + "2024-03-13 09:24:05.176000\n", + "5 upvotes\n", + "\n", "Trump Wins Republican Nomination, Setting Up Rematch with Biden\n", "2024-03-13 05:04:05.536000\n", "5 upvotes\n", @@ -6302,10 +6701,6 @@ "2024-03-03 01:14:05.403000\n", "5 upvotes\n", "\n", - "Arkansas stops offering 'X' as an alternative to male and female on driver's licenses and IDs\n", - "2024-03-13 05:29:05.245000\n", - "4 upvotes\n", - "\n", "CNN interview with classified Docs witness \"could complicate Jack Smith's case\"\n", "2024-03-12 09:24:05.120000\n", "4 upvotes\n", @@ -6354,6 +6749,14 @@ "2024-03-01 22:14:06.307000\n", "4 upvotes\n", "\n", + "Irish anger over Gaza may make for a tense White House St. Patrick’s Day\n", + "2024-03-13 16:24:05.141000\n", + "3 upvotes\n", + "\n", + "What to know about TikTok owner ByteDance ahead of House vote\n", + "2024-03-13 15:09:06.441000\n", + "3 upvotes\n", + "\n", "Ex-Wall Street Banker Takes On AOC in New York Democratic Primary\n", "2024-03-12 16:09:05.453000\n", "3 upvotes\n", @@ -6394,6 +6797,18 @@ "2024-03-04 09:44:05.807000\n", "3 upvotes\n", "\n", + "Judge throws out 6 counts of Trump's Georgia election interference indictment\n", + "2024-03-13 15:29:05.308000\n", + "2 upvotes\n", + "\n", + "Judge tosses six charges in Trump Georgia indictment\n", + "2024-03-13 15:29:05.308000\n", + "2 upvotes\n", + "\n", + "China says TikTok ban would ‘come back to bite the United States’\n", + "2024-03-13 15:19:05.723000\n", + "2 upvotes\n", + "\n", "Furious Hungary summons US envoy over Biden’s ‘dictatorship’ comment | Hungary\n", "2024-03-12 22:39:05.121000\n", "2 upvotes\n", @@ -6446,6 +6861,10 @@ "2024-03-02 05:09:05.356000\n", "2 upvotes\n", "\n", + "Judge Kills Multiple Charges Against Trump in Election Fraud Case\n", + "2024-03-13 16:04:06.916000\n", + "1 upvotes\n", + "\n", "Inflation ticked up in February as Fed weighs interest rate cuts\n", "2024-03-12 18:14:05.358000\n", "1 upvotes\n", @@ -6486,8 +6905,80 @@ "2024-03-02 00:24:05.358000\n", "1 upvotes\n", "\n", + "Katie Porter cries \"rigged\" after losing out in her bid for California Senate\n", + "2024-03-13 18:54:05.511000\n", + "0 upvotes\n", + "\n", + "No Labels to appoint a panel Thursday to pick presidential candidate\n", + "2024-03-13 18:54:05.511000\n", + "0 upvotes\n", + "\n", + "Judge dropping charges against Trump sparks MAGA celebration\n", + "2024-03-13 18:54:05.511000\n", + "0 upvotes\n", + "\n", + "Gotta feel bad for Robert Hur, getting attacked by all sides \n", + "2024-03-13 18:39:05.590000\n", + "0 upvotes\n", + "\n", + "Joe Biden's approval rating falls to all-time low after SOTU\n", + "2024-03-13 15:09:06.442000\n", + "0 upvotes\n", + "\n", + "Biden had repeated mental lapses during special counsel interview: transcript\n", + "2024-03-13 15:09:06.442000\n", + "0 upvotes\n", + "\n", + "Robert F. Kennedy Jr. is considering Aaron Rodgers or Jesse Ventura for a 2024 running mate\n", + "2024-03-13 15:09:06.441000\n", + "0 upvotes\n", + "\n", + "Trump Repeats Obama’s Mistake\n", + "2024-03-13 15:09:06.441000\n", + "0 upvotes\n", + "\n", + "Trump shows slight lead over Biden in new exclusive poll even as views of economy brighten\n", + "2024-03-13 14:59:05.212000\n", + "0 upvotes\n", + "\n", + "White House claims Biden ‘did not apologize’ for using ‘illegal’ to describe Laken Riley’s alleged migrant killer\n", + "2024-03-13 14:39:05.192000\n", + "0 upvotes\n", + "\n", + "My feeling about this presidential election? Nauseated optimism\n", + "2024-03-13 14:19:05.770000\n", + "0 upvotes\n", + "\n", + "What he really means: How Biden is fighting the age issue\n", + "2024-03-13 14:09:05.311000\n", + "0 upvotes\n", + "\n", + "Robert Hur is testifying in front of the House Judiciary Committee on his findings following months of investigating President Biden's mishandling of classified records.\n", + "2024-03-13 13:49:05.071000\n", + "0 upvotes\n", + "\n", + "Chris Wallace looks back at Nixon-Kennedy election in the book \"Countdown 1960\"\n", + "2024-03-13 13:34:05.232000\n", + "0 upvotes\n", + "\n", + "Biden and Trump set for election rematch after clinching nominations\n", + "2024-03-13 13:29:05.313000\n", + "0 upvotes\n", + "\n", + "Family Dollar and Dollar Tree will close 1,000 stores\n", + "2024-03-13 13:19:05.850000\n", + "0 upvotes\n", + "\n", + "Former President Trump has won the Republican presidential caucus in Hawaii\n", + "2024-03-13 13:04:06.232000\n", + "0 upvotes\n", + "\n", + "US trying to overthrow Netanyahu’s government, senior Israeli official says\n", + "2024-03-13 06:54:05.077000\n", + "0 upvotes\n", + "\n", "Looking at our leading candidates in the 2024 presidential race: Would limiting the age of the President to 65 be something you’d support? Why or why not?\n", - "2024-03-13 05:29:05.245000\n", + "2024-03-13 05:44:07.240000\n", "0 upvotes\n", "\n", "Laken Riley’s life was worth no less than George Floyd’s\n", @@ -8018,14 +8509,14 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "[Stage 10:> (0 + 1) / 1]\r" + " \r" ] }, { @@ -8057,9 +8548,21 @@ " |-- upvoteCount: integer (nullable = true)\n", " |-- upvote_ratio: double (nullable = true)\n", " |-- url: string (nullable = true)\n", - "\n", - "['__v', '_id', 'author', 'commentCount', 'commentLink', 'created_utc', 'domain', 'fetchedAt', 'is_self', 'is_video', 'media', 'post_hint', 'selftext', 'selftext_html', 'sub', 'thumbnail', 'title', 'upvoteCount', 'upvote_ratio', 'url']\n", - "Error loading data from MongoDB: Data type string of column title is not supported.\n" + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " \r" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "total count 4288\n" ] }, { @@ -8068,6 +8571,182 @@ "text": [ " \r" ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+---+--------------------------+------+------------+-------------------------------------------------------------------------+-----------+----------------+-----------------------+-------+--------+-----+---------+--------+-------------+----+---------+-----------------------------------------------------------------------------------+-----------+------------+----------------------------------------------------------------------------------------------------------+\n", + "|__v|_id |author|commentCount|commentLink |created_utc|domain |fetchedAt |is_self|is_video|media|post_hint|selftext|selftext_html|sub |thumbnail|title |upvoteCount|upvote_ratio|url |\n", + "+---+--------------------------+------+------------+-------------------------------------------------------------------------+-----------+----------------+-----------------------+-------+--------+-----+---------+--------+-------------+----+---------+-----------------------------------------------------------------------------------+-----------+------------+----------------------------------------------------------------------------------------------------------+\n", + "|0 |{65e0f6047e56c7a1e4ab5396}|nirad |1066 |/r/news/comments/1b37ga3/donald_trump_found_to_have_fraudulently_boosted/|1709231372 |thenational.scot|2024-03-01 23:44:19.914|false |false |NULL |NULL | |NULL |news| |Donald Trump found to have fraudulently boosted value of Scots homes by up to £200m|21842 |0.91 |https://www.thenational.scot/news/24143657.donald-trump-found-fraudulently-boosted-value-scots-homes-200m/|\n", + "+---+--------------------------+------+------------+-------------------------------------------------------------------------+-----------+----------------+-----------------------+-------+--------+-----+---------+--------+-------------+----+---------+-----------------------------------------------------------------------------------+-----------+------------+----------------------------------------------------------------------------------------------------------+\n", + "only showing top 1 row\n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " \r" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "count after date filter 3760\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " \r" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+-----------+-----+\n", + "| bucket|count|\n", + "+-----------+-----+\n", + "| 0-999| 2962|\n", + "| 1000-4999| 513|\n", + "| 5000-9999| 171|\n", + "|10000-24999| 99|\n", + "|25000-49000| 15|\n", + "+-----------+-----+\n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " \r" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+--------------------+-----------+--------------------+---------+\n", + "| title|upvoteCount| fetchedAt| bucket|\n", + "+--------------------+-----------+--------------------+---------+\n", + "|How Israel’s rest...| 0|2024-03-04 04:34:...| 0-999|\n", + "|Hungarian leader ...| 37|2024-03-11 18:59:...| 0-999|\n", + "|Donors at Kansas ...| 77|2024-03-12 00:39:...| 0-999|\n", + "|Biden to propose ...| 149|2024-03-06 22:14:...| 0-999|\n", + "|‘Reprehensible gu...| 354|2024-03-02 22:44:...| 0-999|\n", + "|Apple fined nearl...| 79|2024-03-04 14:19:...| 0-999|\n", + "|Mourners chant ‘w...| 7322|2024-03-02 14:44:...|5000-9999|\n", + "| Drones. | 0|2024-03-09 16:04:...| 0-999|\n", + "|Trump blasts Will...| 0|2024-03-10 04:59:...| 0-999|\n", + "|Trump calls TikTo...| 3|2024-03-12 10:44:...| 0-999|\n", + "|Hamas casualty nu...| 58|2024-03-10 21:59:...| 0-999|\n", + "|Nigeria Plans to ...| 5|2024-03-12 16:39:...| 0-999|\n", + "|Donald Trump not ...| 4899|2024-03-05 12:24:...|1000-4999|\n", + "|9,000 women have ...| 0|2024-03-04 08:04:...| 0-999|\n", + "|South Carolinians...| 11|2024-03-07 21:24:...| 0-999|\n", + "|As terror attacks...| 0|2024-03-06 20:19:...| 0-999|\n", + "|Freighter hit by ...| 40|2024-03-06 17:34:...| 0-999|\n", + "|AOC Slams Protest...| 18|2024-03-06 19:49:...| 0-999|\n", + "|Hunter Biden Had ...| 3977|2024-03-02 13:34:...|1000-4999|\n", + "|House passes $460...| 61|2024-03-06 23:24:...| 0-999|\n", + "+--------------------+-----------+--------------------+---------+\n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " \r" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+--------------------+-----------+--------------------+---------+--------------------+--------------------+--------------------+-----+\n", + "| title|upvoteCount| fetchedAt| bucket| words| filtered| features|label|\n", + "+--------------------+-----------+--------------------+---------+--------------------+--------------------+--------------------+-----+\n", + "|Ultra-conservativ...| 35|2024-03-01 22:09:...| 0-999|[ultra, conservat...|[ultra, conservat...|(1735,[4,40,480,6...| 0.0|\n", + "|Joe Biden has rai...| 49|2024-03-01 22:14:...| 0-999|[joe, biden, has,...|[joe, biden, has,...|(1735,[2,5,8,12,1...| 0.0|\n", + "|Oregon takes mass...| 4|2024-03-01 22:14:...| 0-999|[oregon, takes, m...|[oregon, takes, m...|(1735,[361,412,51...| 0.0|\n", + "|DC Circuit tosses...| 21|2024-03-01 22:19:...| 0-999|[dc, circuit, tos...|[dc, circuit, tos...|(1735,[0,1,3,4,6,...| 0.0|\n", + "|Shervin Hajipour:...| 34|2024-03-01 22:19:...| 0-999|[shervin, hajipou...|[shervin, hajipou...|(1735,[0,9,11,14,...| 0.0|\n", + "|Republicans Who L...| 55|2024-03-01 22:24:...| 0-999|[republicans, who...|[republicans, who...|(1735,[57,65,120,...| 0.0|\n", + "|Jewish dentist ki...| 35|2024-03-01 22:24:...| 0-999|[jewish, dentist,...|[jewish, dentist,...|(1735,[1,20,103,1...| 0.0|\n", + "|Trump's threats a...| 40|2024-03-01 22:29:...| 0-999|[trump, s, threat...|[trump, s, threat...|(1735,[2,5,6,9,23...| 0.0|\n", + "|Only grain ships ...| 29|2024-03-01 22:29:...| 0-999|[only, grain, shi...|[only, grain, shi...|(1735,[4,9,19,74,...| 0.0|\n", + "|Sweden cuts state...| 3821|2024-03-01 22:39:...|1000-4999|[sweden, cuts, st...|[sweden, cuts, st...|(1735,[4,15,22,26...| 1.0|\n", + "|Biden says US mil...| 82|2024-03-01 22:44:...| 0-999|[biden, says, us,...|[biden, says, us,...|(1735,[0,8,9,11,1...| 0.0|\n", + "|Nearly three-quar...| 89|2024-03-01 22:49:...| 0-999|[nearly, three, q...|[nearly, three, q...|(1735,[0,3,28,39,...| 0.0|\n", + "|Ready, set, fly? ...| 8|2024-03-01 22:54:...| 0-999|[ready, set, fly,...|[ready, set, fly,...|(1735,[1,54,98,17...| 0.0|\n", + "|What video and ey...| 2|2024-03-01 22:54:...| 0-999|[what, video, and...|[what, video, and...|(1735,[9,14,21,37...| 0.0|\n", + "|Biden campaign, r...| 47|2024-03-01 23:04:...| 0-999|[biden, campaign,...|[biden, campaign,...|(1735,[5,8,15,33,...| 0.0|\n", + "|Biden announces U...| 1460|2024-03-01 23:09:...|1000-4999|[biden, announces...|[biden, announces...|(1735,[2,8,17,37,...| 1.0|\n", + "|New York AG Letit...| 46|2024-03-01 23:14:...| 0-999|[new, york, ag, l...|[new, york, ag, l...|(1735,[2,18,23,91...| 0.0|\n", + "|Lesbian senator’s...| 65|2024-03-01 23:14:...| 0-999|[lesbian, senator...|[lesbian, senator...|(1735,[2,7,40,58,...| 0.0|\n", + "|UK and US accused...| 8|2024-03-01 23:14:...| 0-999|[uk, and, us, acc...|[uk, and, us, acc...|(1735,[3,9,14,46,...| 0.0|\n", + "|IVF fight comes t...| 19|2024-03-01 23:19:...| 0-999|[ivf, fight, come...|[ivf, fight, come...|(1735,[0,175,288,...| 0.0|\n", + "|Undocumented immi...| 0|2024-03-01 23:19:...| 0-999|[undocumented, im...|[undocumented, im...|(1735,[0,1,6,23,6...| 0.0|\n", + "|Move to split up ...| 7|2024-03-01 23:19:...| 0-999|[move, to, split,...|[move, to, split,...|(1735,[0,1,11,56,...| 0.0|\n", + "|Carol Stream poli...| 41|2024-03-01 23:24:...| 0-999|[carol, stream, p...|[carol, stream, p...|(1735,[3,29,93,10...| 0.0|\n", + "|Fox News ‘Migrant...| 63|2024-03-01 23:29:...| 0-999|[fox, news, migra...|[fox, news, migra...|(1735,[3,6,12,87,...| 0.0|\n", + "|Virginia councilo...| 1056|2024-03-01 23:29:...|1000-4999|[virginia, counci...|[virginia, counci...|(1735,[4,321,441,...| 1.0|\n", + "+--------------------+-----------+--------------------+---------+--------------------+--------------------+--------------------+-----+\n", + "only showing top 25 rows\n", + "\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " \r" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Training Dataset Count: 2642\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + " \r" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Test Dataset Count: 1118\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "24/03/13 18:54:55 WARN Instrumentation: [ff764a5d] regParam is zero, which might cause numerical instability and overfitting.\n", + "24/03/13 18:54:58 WARN Instrumentation: [ff764a5d] Cholesky solver failed due to singular covariance matrix. Retrying with Quasi-Newton solver.\n", + " \r" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Root Mean Squared Error (RMSE) on test data: 3959.606360154408\n" + ] } ], "source": [ @@ -8077,37 +8756,102 @@ " mlflow.log_param(\"param2\", \"value2\")\n", " \n", " try:\n", - " # Create a SparkSession\n", + " # Create a SparkSession\n", " spark = SparkSession.builder \\\n", " .appName(\"F5-MLflow-Spark\") \\\n", " .config(\"spark.jars.packages\", \"org.mongodb.spark:mongo-spark-connector_2.12:3.0.1\") \\\n", " .getOrCreate()\n", " \n", - " # Sample DataFrame with \"title\" and \"upvoteCount\" columns\n", - " data = spark.createDataFrame([\n", - " (\"Title 1\", 10.0),\n", - " (\"Title 2\", 15.0),\n", - " (\"Title 3\", 20.0)\n", - " ], [\"title\", \"upvoteCount\"])\n", "\n", - " # Convert \"title\" column to numerical features using TF-IDF or other text vectorization techniques\n", - " # For demonstration purposes, we'll just use a simple one-hot encoding\n", - " title_vectorizer = VectorAssembler(inputCols=[\"title\"], outputCol=\"title_features\")\n", - " title_vectorized = title_vectorizer.transform(data)\n", + " # Load data from MongoDB into a DataFrame\n", + " df = spark.read.format(\"mongo\").option(\"uri\", URI).option(\"database\", DATABASE).option(\"collection\", COLLECTION).load()\n", + " print(\"Data loaded successfully from MongoDB!\")\n", + " \n", + "\n", + " # Show loaded data\n", + " df.printSchema()\n", + " print('total count', df.count())\n", + " df.show(1,truncate=False)\n", + "\n", + "\n", + " # useful because there are type issues when using the pyspark dataframe issue directly (maybe because of schema? or null objects? or maybe sometimes a column has an int and sometimes a string, idk..)\n", + " df.createOrReplaceTempView(\"temp\")\n", + " df = spark.sql(\"SELECT title, upvoteCount, fetchedAt from temp\") \n", + " \n", + "\n", + " # filter out new posts\n", + " timeAgo = d = datetime.today() - timedelta(days=1)\n", + " df = df.filter(df.fetchedAt < timeAgo)\n", + " print('count after date filter', df.count())\n", + "\n", + "\n", + " # Bucket by upvote count\n", + " def upvoteCategorizer(upvotes):\n", + " if upvotes < 1000:\n", + " return \"0-999\"\n", + " if upvotes < 5000:\n", + " return \"1000-4999\"\n", + " if upvotes < 10000:\n", + " return \"5000-9999\"\n", + " elif upvotes < 25000:\n", + " return \"10000-24999\"\n", + " elif upvotes < 50000:\n", + " return \"25000-49000\"\n", + " else: \n", + " return \"50000+\"\n", + " \n", + " from pyspark.sql.functions import udf\n", + " bucket_udf = udf(upvoteCategorizer, StringType() )\n", + " df = df.withColumn(\"bucket\", bucket_udf(\"upvoteCount\"))\n", + " from pyspark.sql.functions import col\n", + " df.groupBy(\"bucket\").count().orderBy(col(\"count\").desc()).show()\n", + "\n", + " # select sample dataset\n", + " sample_count = 20\n", + " pandas_random_sample = df.toPandas().sample(n=sample_count) # convert to pandas dataframe to take sample\n", + " pyspark_random_sample = spark.createDataFrame(pandas_random_sample) # convert back to pyspark dataframe\n", + " pyspark_random_sample.show()\n", + "\n", + "\n", + " # tokenize and remove stop words\n", + "\n", + " from pyspark.ml.feature import RegexTokenizer, StopWordsRemover, CountVectorizer\n", + " from pyspark.ml.classification import LogisticRegression\n", + "\n", + " # regular expression tokenizer\n", + " regexTokenizer = RegexTokenizer(inputCol=\"title\", outputCol=\"words\", pattern=\"\\\\W\")\n", + "\n", + " # stop words\n", + " add_stopwords = [\"http\",\"https\",\"amp\",\"rt\",\"t\",\"c\",\"the\"] \n", + "\n", + " stopwordsRemover = StopWordsRemover(inputCol=\"words\", outputCol=\"filtered\").setStopWords(add_stopwords)\n", + "\n", + " # bag of words count\n", + " countVectors = CountVectorizer(inputCol=\"filtered\", outputCol=\"features\", vocabSize=30000, minDF=5)\n", + "\n", + "\n", + " from pyspark.ml import Pipeline\n", + " from pyspark.ml.feature import StringIndexer\n", + " label_stringIdx = StringIndexer(inputCol = \"bucket\", outputCol = \"label\")\n", + "\n", + " pipeline = Pipeline(stages=[regexTokenizer, stopwordsRemover, countVectors, label_stringIdx])\n", "\n", - " # Combine \"title\" and \"upvoteCount\" columns into a single feature vector\n", - " assembler = VectorAssembler(inputCols=[\"title_features\", \"upvoteCount\"], outputCol=\"features\")\n", - " data_with_features = assembler.transform(title_vectorized)\n", + " # Fit the pipeline to training documents.\n", + " pipelineFit = pipeline.fit(df)\n", + " dataset = pipelineFit.transform(df)\n", + " dataset.show(25)\n", "\n", " # Split data into training and testing sets\n", - " train_data, test_data = data_with_features.randomSplit([0.8, 0.2], seed=123)\n", + " (trainingData, testData) = dataset.randomSplit([0.7, 0.3], seed = 100)\n", + " print(\"Training Dataset Count: \" + str(trainingData.count()))\n", + " print(\"Test Dataset Count: \" + str(testData.count()))\n", "\n", " # Train a linear regression model\n", - " lr = LinearRegression(featuresCol=\"features\", labelCol=\"upvoteCount\")\n", - " lr_model = lr.fit(train_data)\n", + " lr = LinearRegression(featuresCol=\"features\", labelCol=\"label\")\n", + " lr_model = lr.fit(trainingData)\n", "\n", " # Evaluate the model on test data\n", - " predictions = lr_model.transform(test_data)\n", + " predictions = lr_model.transform(testData)\n", " rmse = predictions.selectExpr(\"sqrt(avg(pow(upvoteCount - prediction, 2))) as RMSE\").collect()[0][\"RMSE\"]\n", " print(\"Root Mean Squared Error (RMSE) on test data:\", rmse)\n", " \n",