views.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:uncommonhacks 作者: meggrasse 项目源码 文件源码
def message():
    #body_mes = client.messages.Body
    resp = twilio.twiml.Response()
    resp.message("Thanks, expect a call soon!")
    messages = deque(client.messages.list())
    last_message = messages.popleft()
    last_text = last_message.body
    phone_number = last_message.from_
    f = open('phonenumber.txt', 'w')
    f.write(phone_number)
    list_of_tuples = get_sent_tuples(parse_string(str(last_text)))
    # print list_of_tuples
    list_of_chords=get_chords(list_of_tuples)
    # print list_of_chords
    print "test"
    abcstring=simpleasabc(list_of_chords)
    print "test1"
    myabcfile=open("app/PySynth/abcsheet.abc.txt",'w')
    myabcfile.write(abcstring)
    myabcfile.close()
    os.chdir("/Users/Meg/Documents/Hackathons/uncommonhacks/app/PySynth")
    # command = "cd"
    # process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
    # print process.communicate()[0]
    # command = "cd PySynth"
    # process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
    # print process.communicate()[0]
    command = "python wavesdontdie.py abcsheet.abc.txt"
    process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
    print process.communicate()[0]
    os.chdir("/Users/Meg/Documents/Hackathons/uncommonhacks")
    f = open('phonenumber.txt', 'r')
    phone_number = f.read()
    call = client.calls.create(url="http://twimlbin.com/23667f37ab8451dbb3223f51d2248f21",
        to=phone_number,
        from_="+16307556548")
    return str(resp)

# @app.route("/makecall", methods=['GET', 'POST'])
# def makecall():
#   f = open('phonenumber.txt', 'r')
#   phone_number = f.read()
#   call = client.calls.create(url="http://twimlbin.com/23667f37ab8451dbb3223f51d2248f21",
#       to=phone_number,
#       from_="+16307556548")
#   return "working"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号