Exemple #1
0
def weixin(request):
    if request.method == 'GET':
        return weixin_reg(request)
    elif request.method == 'POST':
        return HttpResponse(process(request))
    else:
        return HttpResponse(None)
Exemple #2
0
def weixin_test(request):
    import test
    tmpobj = test.request()
    instr = smart_str(request.GET.get("input",None))
    #instr = instr.decode('utf-8','ignore')
    #print instr + 'new\n'
    tmpobj.setmessage(instr)
    if request.GET.get("type",None):
        tmpobj.locationmessage(request.GET.get("type"))
    a = process(tmpobj)
    #print a
    a = a.replace('<','&lt;')
    a = a.replace('>','&gt;')
    
    return HttpResponse("<title>test page</title><body><pre>%s</pre></body>" % a)
Exemple #3
0
                            
if __name__ == "__main__":
    #execute_from_command_line("runserver")   
    #os.environ.setdefault("DJANGO_SETTINGS_MODULE", "weixin_sae.jiakangyu.dev.weixin.settings")    
    #setup_environ
    import sys
    sys.path.insert(0, "/weixin")
    import os 
    os.environ['DJANGO_SETTINGS_MODULE']='weixin.settings'
    from message.process import process
        
    a = request()
    #a.textmessageA("autoquery:[15249080007]")
    a.setmessage("news:[Mea]")
    
    str = process(a)
    str
    #print unicode(str,'utf-8','ignore')
    #print str#.decode('gb18030','ignore')
    
    a.locationmessage("bb")
    
    str = process(a)
    print str
    print str.decode('gb18030','ignore')
'''    
    a.setmessage("setting:weather[text]")
    str = process(a)
    print str    
    
    a.locationmessage()