Пример #1
0
def auto_buy_item(info, ordered_items, place, settings):
    """
    Proceeds to auto-buy the item that is in stock. Notifies the
    user if notifications are enabled.
    """
    if delegate_purchase(info.get('webshop'), info.get('url'), settings):
        print("[=== ITEM ORDERED, HOORAY! ===] [=== {} ===]".format(place))
        if settings.get("natively_notify"):
            notification.title = "Hooray, item ordered at {}".format(place)
            notification.message = "Check your email for a confirmation of your order"
            notification.send()
        if settings.get("sms_notify"):
            try:
                api = callr.Api(settings.get("callr_username"),
                                settings.get("callr_password"))
                api.call('sms.send', 'SMS', settings.get("phone"),
                         "Hooray! Item ordered at {}!".format(place), None)
            except (callr.CallrException, callr.CallrLocalException) as e:
                print(
                    "[=== ERROR ===] [=== SENDING SMS FAILED ===] [ CHECK ACCOUNT BALANCE AND VALIDITY OF CALLR "
                    "CREDENTIALS ===]")
        ordered_items += 1
        # if reached max amount of ordered items
        if not ordered_items < settings.get("max_ordered_items"):
            print(
                "[=== Desired amount of ordered items reached! ===] [=== Bye! ===]"
            )
            sys.exit(0)
    return ordered_items
Пример #2
0
def callr_send_sms(message_value, buyer_phone):
    # Short track link
    # Not in use...
    # bit_link = bitly_shorter(
    #     link=f"https://members.lionwheel.com/locate/locate_task?locate%5Btask_public_id%5D={butikBarCode}",
    #     with_http=False)
    # print(bit_link)

    ## Send the SMS
    api = callr.Api("spider3d_1", "Idan05423")
    result = api.call("system.get_timestamp")
    print("result is ", result)

    _buyer_phone = f"+972{buyer_phone[1:]}"
    print(_buyer_phone)
    # print(type(_buyer_phone))

    # input("R u sure u want pay 0.26₪ to send SMS ?")
    # input("Please confirm again.")
    _sms_hash = api.call('sms.send', 'SMS', _buyer_phone, message_value, None)
    # _sms_hash = "0LWLNVLH"
    print("_sms_hash is ", _sms_hash)
    return _sms_hash
Пример #3
0
import callr
HIST = "https://devakademi.sahibinden.com/history"
TICK = "https://devakademi.sahibinden.com/ticker"

api = callr.Api("marmarauniversity_1", "212427123")

description = """
    dev.akademi predictor scoin
    Usage: python predict.py  [OPTION] values
    Eg: python3 predict.py -d 10
    Eg: python3 predict.py -ds 5
"""
description2 = """
    dev.akademi bot sell ant buy scoin
    Usage: python bot.py  [OPTION] values
    Eg: python3 predict.py -s 10000 -n +905346639019
    Eg: python3 predict.py -b 11000 -n +905346639019
"""
Пример #4
0
import callr, os, sys, time

api = callr.Api("Identifiant", "Mot de passe")

stalker = "+" + input(
    "Entre le numéro du harceleur avec l'indicatif (33 pour la France) exemple 33123456789: "
)
message = ['TTS|TTS_FR-FR_AUDREY|' + input("entre le message à envoyé : ")]

target = {'number': stalker, 'timeout': 30}

count = 0
while True:
    count += 1
    print(str(count) + " appel émis vers " + stalker)
    result = api.call('sendr/simple.broadcast_1', target, message, None)
    time.sleep(0.2)
Пример #5
0
def main():
    """
    Function that loops until the 'desired amount of items bought' is reached.

    While that amount is not reached, the function checks whether the item is
    in stock for every webshop in the locations dictionary. Once an item is in
    stock, it will proceed to buy this item by calling the `delegate_purchase`
    function. This function takes the name of the webshop and the url of the
    item as its arguments.

    Between every check, there is a wait of 30 seconds.
    """
    # get settings
    settings = ask_to_configure_settings()
    user_agent = random.choice(user_agents)
    referer = random.choice(referers)
    ordered_items = 0
    # loop until desired amount of ordered items is reached
    while True:
        detected_as_bot = []
        times_detected_as_bot = 0
        # ==================================================== #
        # loop through all web-shops where potentially in stock #
        # ==================================================== #
        for place, info in sorted(locations.items(),
                                  key=lambda x: random.random()):
            # generate headers
            # user_agent = random.choice(user_agents)
            headers = {
                "User-Agent": user_agent,
                "Accept-Encoding": "gzip, deflate",
                'Accept':
                'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
                'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
                'sec-fetch-site': 'same-origin',
                'sec-fetch-mode': 'navigate',
                'sec-fetch-user': '******',
                'sec-fetch-dest': 'document',
                'referer': referer,
                "Connection": "close",
                "Upgrade-Insecure-Requests": "1"
            }
            try:
                content = requests.get(info.get('url'),
                                       timeout=5,
                                       headers=headers).content.decode('utf-8')
            except (requests.exceptions.ConnectionError,
                    requests.exceptions.ReadTimeout,
                    requests.exceptions.ChunkedEncodingError) as e:
                console.log(f"[ [bold red]REQUEST ERROR[/] ] [ {place} ]")
                continue
            # ======================================== #
            # item in stock, proceed to try and buy it #
            # ======================================== #
            if (info.get('detectedAsBotLabel') not in content
                    and info.get('outOfStockLabel') not in content
                    and info.get('inStockLabel') in content):
                console.log(f"[ [bold green]OMG, IN STOCK![/] ] [ {place} ]")
                # === IF ENABLED, SEND SMS === #
                if settings.get("sms_notify") and not info.get('inStock'):
                    try:
                        api = callr.Api(settings.get("callr_username"),
                                        settings.get("callr_password"))
                        api.call(
                            'sms.send', 'SMS', settings.get("phone"),
                            "Item might be in stock at {}. URL: {}".format(
                                place, info.get('url')), None)
                    except (callr.CallrException,
                            callr.CallrLocalException) as e:
                        console.log(
                            "[ [red bold]SENDING SMS FAILED[/] ] [ CHECK ACCOUNT BALANCE AND CALLR CREDENTIALS ]"
                        )
                # === NATIVE OS NOTIFICATION === #
                if settings.get("natively_notify"):
                    notification.title = "Item might be in stock at:".format(
                        place)
                    notification.message = info.get('url')
                    notification.send()
                # === IF ENABLED, BUY ITEM === #
                if settings.get("auto_buy"):
                    ordered_items = auto_buy_item(info, ordered_items, place,
                                                  settings)

                # === SET IN-STOCK TO TRUE === #
                info['inStock'] = True
            elif info.get('detectedAsBotLabel') in content:
                detected_as_bot.append(place)
                console.log(f"[ [bold red]DETECTED AS BOT[/] ] [ {place} ]")
                times_detected_as_bot += 1
                # rotate headers stuff
                user_agent = random.choice(user_agents)
                referer = random.choice(referers)
            elif info.get('outOfStockLabel') in content:
                info['inStock'] = False
                console.log(f"[ OUT OF STOCK ] [ {place} ]")
            else:
                console.log(f"[ [bold red]ERROR IN PAGE[/] ] [ {place} ]")
            time.sleep(random.randint(45, 75) / 100.0)

        # print report
        print('\n')
        console.log(
            f"Total requests: [bold red]{len(locations)}[/]. Amount of times detected as bot: "
            f"[bold red]{times_detected_as_bot}[/].\nFor pages: [bold red]{detected_as_bot}\n"
        )
Пример #6
0
# INITIALIZATION

import callr
api = callr.Api("harleywebservices_1","Junior4210@1")
testSMS = api.call('sms.send','SMS',"+12532057177","SKU #12345 needs replen",None)

def SendSMS():
    return testSMS
Пример #7
0
import callr

try:
    ## initialize instance Callr
    # set your credentials or an Exception will raise
    api = callr.Api("login", "password")

    ## an optional third parameter let you add options like proxy support
    # proxy must be in url standard format
    # http[s]://user:password@host:port
    # http[s]://host:port
    # http[s]://host

    # options = {
    # 	"proxy": "https://*****:*****@example.com:8080"
    # }
    # api = callr.Api("login", "password", options)

    ## Basic example
    # Example to send a SMS
    # 1. "call" method: each parameter of the method as an argument
    result = api.call("sms.send", "SMS", "+33123456789", "Hello, world",
                      {"flash_message": False})

    # 2. "send" method: parameter of the method is an array
    my_array = [
        "SMS", "+33123456789", "Hello, world", {
            "flash_message": False
        }
    ]
    result = api.send("sms.send", my_array)
Пример #8
0
import callr

## Sms service from callr

api = callr.Api("spider3d_1", "Idan05423")
# result = api.call("system.get_timestamp")

# 60 Character Example ( Until 70 -> 0.078$ = 0.26₪ )
text = ('ההזמנה שלך מספיידר 3D נאספה למשלוח מהיר ' + f'למעקב: bit.ly/2MHCASy ')

input("R u sure u want pay 0.26₪ to send SMS ?")
input("Please confirm again.")
result = api.call('sms.send', 'SMS', '+972584770076', text, None)
print(result)
Пример #9
0
LISTING_DETAIL_BTN_SELECTOR = '.btn-details'
NEXT_PAGE_SELECTOR = '.next'
GEOLOC_SELECTOR = '.item-geoloc'
SPECS_SELECTOR = '.item-summary'
DESCRIPTION_SELECTOR = '.item-description'
METRO_SELECTOR = '.item-metro .label'
PRICE_SELECTOR = '.price'

CALLR_API_LOGIN = os.environ.get('LOGIN')
CALLR_API_PASSWORD = os.environ.get('PASSWORD')
GOOGLE_SHORTENER_API_KEY = os.environ.get('API_KEY')

PHONE = os.environ.get('PHONE')

shortener = Shortener('Google', api_key=GOOGLE_SHORTENER_API_KEY)
api = callr.Api(CALLR_API_LOGIN, CALLR_API_PASSWORD)


def get_scraped_page(url):
    res = requests.get(url)
    return Bs(res.text, 'lxml')


def clean_markup(string):
    string = clean_special_chars(string)
    return re.sub(r'<[^>]*>', '', string)


def clean_spaces(string):
    string = re.sub('\n|\r|\t', ' ', string)
    return re.sub('\s{2,}', ' ', string).strip()