import urllib.request
import time
def send_to_twitter():
import sys
import tweepy
CONSUMER_KEY = '1wrnsF5lB8fEWVzRdvlIqdTl'
CONSUMER_SECRET = 'eTiylDUHLJgGnTCcxzzCtzHXG4OlHrbY6wLvuZUnAEhrokyNA'
ACCESS_KEY = '2325915097-q2JYaZ3UGeL9Pr95BJC7643NMyETY6x7Bb8T1q'
ACCESS_SECRET = '8GRq4e9ukVKcC8XjroM3iLKuZYOM2QtFEdCHXG3TXx0z'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)
api.update_status(msg)
def get_price():
page = urllib.request.urlopen("http://beans-r-us.appspot.com/prices-loyalty.html")
text = page.read().decode("utf8")
where = text.find('>$')
start_of_price = where + 2
end_of_price = start_of_price + 4
return(text[start_of_price : end_of_price])
escolha = input("Precisa do valor imediatamente? ")
if escolha == 'y':
send_to_twitter(get_price())
else:
if escolha == 'n':
price = 99.99
while price > 4.74:
price = float(get_price())
time.sleep(3)
send_to_twitter('BUY!')
else:
print("Voce nao escolheu nada")
Error message:
Traceback (most recent call last):
File "(livro)programa_com_escolha_cafe.py", line 34, in <module>
send_to_twitter('BUY!')
TypeError: send_to_twitter() takes 0 positional arguments but 1 was given