This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy | |
from dotenv import load_dotenv | |
import os | |
from websocket import create_connection | |
import json | |
load_dotenv() | |
ws = create_connection(os.environ["WEBSOCKET_SERVER_URL"]) | |
auth = tweepy.OAuthHandler(os.environ["TWITTER_API_KEY"], os.environ["TWITTER_API_SECRET_KEY"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3 | |
Add twitter_client.py / | |
Add requirements.txt / | |
RUN pip install -r /requirements.txt | |
CMD [ "python", "./twitter_client.py" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<div class="text-2xl text-blue-400 mb-5">Realtime Dev Tweets</div> | |
<div | |
v-for="tweet in tweets" | |
:key="tweet.id" | |
class="border-2 border-blue-400 p-1 mb-4 shadow rounded" | |
> | |
<div class="flex mb-2"> | |
<div class="mr-2"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="bg-gray-300 flex flex-col h-screen"> | |
<Header /> | |
<div class="p-8 w-3/4 mx-auto bg-white flex-1"> | |
<Tweets /> | |
</div> | |
</div> | |
</template> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div></div> | |
</template> | |
<script> | |
export default { | |
name: "Tweets" | |
}; | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="bg-black h-32 p-8 shadow"> | |
<div class="text-white text-3xl font-bold">Dev Tweets</div> | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy | |
from dotenv import load_dotenv | |
import os | |
from websocket import create_connection | |
import json | |
load_dotenv() | |
ws = create_connection("ws://localhost:8088") | |
auth = tweepy.OAuthHandler(os.getenv("API_KEY"), os.getenv("API_SECRET_KEY")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WebSocket = require('ws') | |
const wss = new WebSocket.Server({ port: 8088 }) | |
wss.broadcast = function broadcast(data) { | |
wss.clients.forEach((client) => { | |
client.send(data) | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy | |
from dotenv import load_dotenv | |
import os | |
load_dotenv() | |
auth = tweepy.OAuthHandler(os.getenv("API_KEY"), os.getenv("API_SECRET_KEY")) | |
auth.set_access_token(os.getenv("ACCESS_TOKEN"), | |
os.getenv("ACCESS_TOKEN_SECRET")) | |
api = tweepy.API(auth) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API_KEY="<your twitter api key>" | |
API_SECRET_KEY="<your twitter api secret key>" | |
ACCESS_TOKEN="<your twitter access token>" | |
ACCESS_TOKEN_SECRET="<your twitter access token secret>" |