コード例 #1
0
ファイル: sms.py プロジェクト: nomadbitcoin/work-to-share
def sendSms(text, return_error=False):
    try:
        twilio_ssid = login.getToken("twilio_ssid")
        twilio_token = login.getToken("twilio_token")

        client = Client(twilio_ssid, twilio_token)
        client.messages.create(from_='+17547145366',
                               to='+5547988917321',
                               body=text)
        return True
    except Exception as error:
        if return_error == True:
            return error
        else:
            return False
コード例 #2
0
def main():
    logger.info(
        '----------------------------开始搬砖--------------------------------')
    users = config.getUsers()
    for user in users:
        token = login.getToken(user)
        if (token and len(token) > 0):
            logger.info('--------------用户切换成功:{0},开始报名--------------'.format(
                user["phone"]))

            freebeautytry.fetchFreeBeautyTry(user)

            logger.info('--------------用户:{0}报名结束--------------'.format(
                user["phone"]))

    config.checkToken()
    logger.info('--------全部报名结束-----------')
コード例 #3
0
#!/usr/bin/python
import httplib
import urllib
from websocket import create_connection
import ssl

from login import getToken

token = getToken('tester', '12345')

ws = create_connection('wss://144.76.140.147/api/tn?symbol=BTC/USD&token=%s' %
                       token,
                       sslopt={'cert_reqs': ssl.CERT_NONE})

order = '{"name": "AddOrder", "header": {"clorder_id": "1"}, "symbol": "BTC/USD", \
         "dir": "Buy",  \
         "amount": 1, "price": 1600.00000000}'

print '%s' % order
ws.send(order)
cancel = '{"name": "CancelOrder", "header": {"clorder_id": "2"}, "symbol": "BTC/USD", \
          "dir": "Buy", \
          "orig_clorder_id": "1" }'

print '%s' % cancel
ws.send(cancel)

# First you get active orders
while True:
    result = ws.recv()
    print 'Received: %s' % result