コード例 #1
0
ファイル: a2.py プロジェクト: ffyuanda/problems
def upload_option(profile: Profile):
    """
    The interface to upload profile to server,
    working with ds_client module's send().
    :param profile: current working profile object
    :return: None
    """
    option = input("Do you want to also upload it to the server? (y/n)\n").upper()
    server = profile.dsuserver
    username = profile.username
    password = profile.password
    message = profile.get_posts()
    bio = profile.bio

    if option == 'Y':
        print("Send post (p)")
        print("Update bio (b)")
        print("Send post and update bio (pb)")
        option = input()
        client.send(option, server, PORT, username, password,
                    message, bio)

    elif option == 'N':
        print("Done.")

    else:
        print('please enter either y or n\n')
        upload_option(profile)
コード例 #2
0
 def publish(self, np: NaClProfile):
     import ds_client
     send_type = 'pb'
     server = np.dsuserver
     port = 2021
     username = np.username
     password = np.password
     posts = np.get_posts()
     bio = np.get_bio()
     ds_client.send(np, send_type, server, port, username, password, posts,
                    bio)