def user_timeline():
    auth_instance = Auth("Nr8NWrnIr1huPmlTy3OFfizCl",
                         "94MmEh9HSAGIiolIGSb6hBXXGlFM9weMZNrGjKs6hhJEoNfolr",
                         "835036132773605377-ChnMv7F4s7DO6eG1BbKVafgZjYBf1at",
                         "jiKWm8tUzXAXuY0ovxc7XWnsbdGj60frsBLUdVIuya7Hr")
    api = auth_instance.authorize()

    #api.update_status("hello ")
    tweets = api.user_timeline(screen_name="samsclubauct",
                               in_reply_to_status_id="835839191388991488")
    #data = json.dumps(tweets);
    #print(data['id_str'])

    #for status in tweepy.Cursor(api.user_timeline ,screen_name="samsclubauct", since_id="835839191388991488",in_reply_to_status_id="835839191388991488", count= 20).items() :
    #	print(status.text)

    #for status in tweepy.Cursor(api.user_timeline ,screen_name="samsclubauct", since_id="835839191388991488",in_reply_to_status_id="835839269621071872", count= 20).items() :
    #	print(status.text)

    #for status in tweepy.Cursor(api.user_timeline ,screen_name="samsclubauct", since_id="835839191388991488",conversation_id="835839191388991488", count= 20).items() :
    #	print(status.text)
    #	print(status.id)

    #for status in tweepy.Cursor(api.user_timeline ,screen_name="samsclubauct", in_reply_to_user_id_str="835839191388991488", count= 20).items() :
    #	print(status.text)

    for tweet in tweets:
        print(tweet.text)
Beispiel #2
0
def create_new_reply_temp(status_id, auction_id, bid_value):
    auth_instance = Auth("Nr8NWrnIr1huPmlTy3OFfizCl",
                         "94MmEh9HSAGIiolIGSb6hBXXGlFM9weMZNrGjKs6hhJEoNfolr",
                         "835036132773605377-ChnMv7F4s7DO6eG1BbKVafgZjYBf1at",
                         "jiKWm8tUzXAXuY0ovxc7XWnsbdGj60frsBLUdVIuya7Hr")
    api = auth_instance.authorize()
    tweet = "@samsclubauct #" + auction_id + " Bid from Website User: " + bid_value
    api.update_status(tweet, status_id)
Beispiel #3
0
def fetch_replies_from_tweet(tweet_id):
    auth_instance = Auth("Nr8NWrnIr1huPmlTy3OFfizCl",
                         "94MmEh9HSAGIiolIGSb6hBXXGlFM9weMZNrGjKs6hhJEoNfolr",
                         "835036132773605377-ChnMv7F4s7DO6eG1BbKVafgZjYBf1at",
                         "jiKWm8tUzXAXuY0ovxc7XWnsbdGj60frsBLUdVIuya7Hr")
    api = auth_instance.authorize()

    tweet = api.get_status(tweet_id)
    print(tweet)
def winner_tweet_temp(winner_handle, product_url, product_image, product_name):
    auth_instance = Auth("Nr8NWrnIr1huPmlTy3OFfizCl",
                         "94MmEh9HSAGIiolIGSb6hBXXGlFM9weMZNrGjKs6hhJEoNfolr",
                         "835036132773605377-ChnMv7F4s7DO6eG1BbKVafgZjYBf1at",
                         "jiKWm8tUzXAXuY0ovxc7XWnsbdGj60frsBLUdVIuya7Hr")
    api = auth_instance.authorize()

    api.update_status("The winner of this auction for " + product_name +
                      " is : " + winner_handle + "\n Get your product at : " +
                      product_url + " image " + product_image)
Beispiel #5
0
def create_tweet1(auction_id, product_name, image_url, cur_bidding_price,
                  auction_end_time):
    auth_instance = Auth("Nr8NWrnIr1huPmlTy3OFfizCl",
                         "94MmEh9HSAGIiolIGSb6hBXXGlFM9weMZNrGjKs6hhJEoNfolr",
                         "835036132773605377-ChnMv7F4s7DO6eG1BbKVafgZjYBf1at",
                         "jiKWm8tUzXAXuY0ovxc7XWnsbdGj60frsBLUdVIuya7Hr")
    api = auth_instance.authorize()
    image_path = utils.download_image(auction_id, image_url)
    weet = "Product: " + product_name[:
                                      50] + "\nCurr Bidding Price : " + cur_bidding_price + "\nAuction Ends in: " + auction_end_time + "\n#" + auction_id
    status = api.update_with_media(image_path, status=tweet)
    print(status.id)
    return status.id
def fetch_replies_of_tweet1(auction_id):
    auth_instance = Auth("Nr8NWrnIr1huPmlTy3OFfizCl",
                         "94MmEh9HSAGIiolIGSb6hBXXGlFM9weMZNrGjKs6hhJEoNfolr",
                         "835036132773605377-ChnMv7F4s7DO6eG1BbKVafgZjYBf1at",
                         "jiKWm8tUzXAXuY0ovxc7XWnsbdGj60frsBLUdVIuya7Hr")
    api = auth_instance.authorize()

    replies = api.search(q="#" + auction_id)

    dictnry = dict()

    for reply in replies:
        tweet = reply.text
        amount = extract_amount_from_tweet(tweet)
        author = reply.author._json['screen_name']
        if author in dictnry:
            dictnry[author].append(amount)
        else:
            dictnry[author] = []
            dictnry[author].append(amount)

    #return dictnry
    return jsonize(dictnry)
Beispiel #7
0
    text = image[:-3] + "txt"
    return text


def fetch_auction_elements(api):
    image_files = os.listdir("../auction_images")

    i = 0
    for image_file in image_files:
        if i == 4:
            break

        auction_text_file = get_auctiontext_from_image(image_file)
        post_tweet(api, image_file, auction_text_file)
        i += 1


def post_dummy(api):
    status = api.update_status("hey everyone")
    print(status)


if __name__ == '__main__':
    auth_instance = Auth("Nr8NWrnIr1huPmlTy3OFfizCl",
                         "94MmEh9HSAGIiolIGSb6hBXXGlFM9weMZNrGjKs6hhJEoNfolr",
                         "835036132773605377-ChnMv7F4s7DO6eG1BbKVafgZjYBf1at",
                         "jiKWm8tUzXAXuY0ovxc7XWnsbdGj60frsBLUdVIuya7Hr")
    api = auth_instance.authorize()
    #read_timeline(api)
    #fetch_auction_elements(api)
    #post_dummy(api)
import telebot
from Authentication import Authentication as Auth
from DataBase import EvandExcelParser as EEP
import pandas as pd
TOKEN = '691564985:AAH-B1geClWEv-cUsosVs_PldlLfQSuvd00'

bot = telebot.TeleBot(TOKEN)
auth = Auth(path_file='users_telegram/')
auth.set_state_list(['start', 'get_identication', 'complete'])
eep = EEP(file_path='list.xlsx')

users_row = dict()


def identication_parser(message):
    if auth.get_state(message) == 'start':
        return 1
    else:
        return 0


def entername_stage(message):
    if auth.get_state(message) == 'get_identication':
        return 1
    else:
        return 0


@bot.message_handler(commands=['start'])
def start_command_response(message):
    print(message.chat)
Beispiel #9
0
def Authenticate_keys(consumer_key , consumer_secret, access_token , access_token_secret):
	auth_instance = Auth(consumer_key , consumer_secret , access_token , access_token_secret)
	api = auth_instance.authorize()
	return api