Пример #1
0
def memberMessages(opts):

    try:
        api = Trading(debug=opts.debug, config_file=opts.yaml, appid=opts.appid,
                      certid=opts.certid, devid=opts.devid, warnings=True)

        now = datetime.datetime.now()

        memberData = {
            "WarningLevel": "High",
            "MailMessageType": "All",
            # "MessageStatus": "Unanswered",
            "StartCreationTime": now - datetime.timedelta(days=60),
            "EndCreationTime": now,
            "Pagination": {
                "EntriesPerPage": "5",
                "PageNumber": "1"
            }
        }

        api.execute('GetMemberMessages', memberData)

        dump(api)

        if api.response_dict().MemberMessage:
            messages = api.response_dict().MemberMessage.MemberMessageExchange

            if type(messages) != list:
                    messages = [ messages ]

            for m in messages:
                print("%s: %s" % (m.CreationDate, m.Question.Subject[:50]))

    except ConnectionError as e:
        print e
Пример #2
0
def run(opts):

    try:
        api = Trading(debug=opts.debug, config_file=opts.yaml, appid=opts.appid,
                      certid=opts.certid, devid=opts.devid)

        api.execute('GetCharities', {'CharityID': 3897})
        dump(api)
        print(api.response_dict().Charity.Name)

    except ConnectionError as e:
        print e
Пример #3
0
def memberMessages(opts):

    try:
        api = Trading(debug=opts.debug,
                      config_file=opts.yaml,
                      appid=opts.appid,
                      certid=opts.certid,
                      devid=opts.devid,
                      warnings=True)

        now = datetime.datetime.now()

        memberData = {
            "WarningLevel": "High",
            "MailMessageType": "All",
            # "MessageStatus": "Unanswered",
            "StartCreationTime": now - datetime.timedelta(days=60),
            "EndCreationTime": now,
            "Pagination": {
                "EntriesPerPage": "5",
                "PageNumber": "1"
            }
        }

        api.execute('GetMemberMessages', memberData)

        dump(api)

        if api.response_dict().MemberMessage:
            messages = api.response_dict().MemberMessage.MemberMessageExchange

            if type(messages) != list:
                messages = [messages]

            for m in messages:
                print("%s: %s" % (m.CreationDate, m.Question.Subject[:50]))

    except ConnectionError as e:
        print e
Пример #4
0
def feedback(opts):
    try:
        api = Trading(debug=opts.debug, config_file=opts.yaml, appid=opts.appid,
                      certid=opts.certid, devid=opts.devid, warnings=False)

        api.execute('GetFeedback', {'UserID': 'tim0th3us'})
        dump(api)

        if int(api.response_dict().FeedbackScore) > 50:
            print("Doing good!")
        else:
            print("Sell more, buy more..")
    
    except ConnectionError as e:
        print e
Пример #5
0
def run(opts):

    try:
        api = Trading(debug=opts.debug,
                      config_file=opts.yaml,
                      appid=opts.appid,
                      certid=opts.certid,
                      devid=opts.devid)

        api.execute('GetCharities', {'CharityID': 3897})
        dump(api)
        print(api.response_dict().Charity.Name)

    except ConnectionError as e:
        print e
Пример #6
0
def feedback(opts):
    try:
        api = Trading(debug=opts.debug,
                      config_file=opts.yaml,
                      appid=opts.appid,
                      certid=opts.certid,
                      devid=opts.devid,
                      warnings=False)

        api.execute('GetFeedback', {'UserID': 'tim0th3us'})
        dump(api)

        if int(api.response_dict().FeedbackScore) > 50:
            print("Doing good!")
        else:
            print("Sell more, buy more..")

    except ConnectionError as e:
        print e