forked from acmpesuecc/TwitterBotCryptocurrencyPrice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwbot.py
34 lines (28 loc) · 1.32 KB
/
twbot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import tweepy
import requests
import json
import time
API = "YNDmqZ7KIQfz05mJ5UH2iUW96"
api_key_secret = "inPMlkfKG1bAu3jEAMQmPPQKVTnK72NX8eEXsbJnZWAkp656ga"
bearertoken = "AAAAAAAAAAAAAAAAAAAAALXtawEAAAAA0Iue9sAXNWk1HVqXKWU9zpFWz5A%3DP8PCB5VTt8ud4OopsI57SqL3Adz2vAWl7gLqFmZDOpnY7zn1HN"
accesstoken = "1509571461266419715-sMZB14yh7DAcV94AnhUJZ9jwjvpnwp"
access_token_secret = "CvmUMbXvS4CKj3nFTch5Ciigdvwvm3qccbCdCf2KlayRx"
auth_handler = tweepy.OAuthHandler(consumer_key=API, consumer_secret=api_key_secret)
auth_handler.set_access_token(accesstoken, access_token_secret)
api = tweepy.API(auth_handler, wait_on_rate_limit=True)
switch = 1
while switch == 1:
crypto = requests.get(
'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Ccardano%2Cethereum%2Csolana%2Cmatic%2C&vs_currencies=inr%2Cinr%2Cinr%2Cinr%2Cinr%2C'
)
price_crypto_inr = crypto.json()
cardano = str(price_crypto_inr['cardano']['inr'])
bitcoin = str(price_crypto_inr['bitcoin']['inr'])
solana = str(price_crypto_inr['solana']['inr'])
ethereum = str(price_crypto_inr['ethereum']['inr'])
tweet = "📉BTC: ₹" + bitcoin +"\n" + "📉ADA: ₹" + cardano +"\n" + "📈SOL: ₹" + solana +"\n" + "💸ETH: ₹" + ethereum
# tweet = "Hi"
api.update_status(tweet)
print(tweet)
time.sleep(10*60*60)
print("Tweeted")