Subversion Repositories SmartDukaan

Rev

Rev 18896 | Rev 18902 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18896 Rev 18901
Line 1586... Line 1586...
1586
    tinInfo = {}
1586
    tinInfo = {}
1587
    try:
1587
    try:
1588
        params = ['tin','cst','counter_name','counter_address','state','pan','registered_on','cst_status','valid_since','created']
1588
        params = ['tin','cst','counter_name','counter_address','state','pan','registered_on','cst_status','valid_since','created']
1589
        url  = "http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber=" + tin + "&searchBy=TIN"
1589
        url  = "http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber=" + tin + "&searchBy=TIN"
1590
        req = urllib2.Request(url)
1590
        req = urllib2.Request(url)
-
 
1591
        print url
1591
        connection = urllib2.urlopen(req)
1592
        connection = urllib2.urlopen(req)
1592
        pageHtml = connection.read()
1593
        pageHtml = connection.read()
1593
        connection.close()        
1594
        connection.close()        
1594
        doc = pq(pageHtml)
1595
        doc = pq(pageHtml)
1595
        index=-1
1596
        index=-1
Line 1597... Line 1598...
1597
            index += 1
1598
            index += 1
1598
            text = pq(ele).text().strip()
1599
            text = pq(ele).text().strip()
1599
            if not text:
1600
            if not text:
1600
                text = pq(ele)('div').text().strip()
1601
                text = pq(ele)('div').text().strip()
1601
            tinInfo[params[index]] = text
1602
            tinInfo[params[index]] = text
-
 
1603
        print index, "index"
1602
        if index != 9:
1604
        if index != 8:
1603
            raise
1605
            raise
1604
        print "TinNumber: Successfully fetched details", tin
1606
        print "TinNumber: Successfully fetched details", tin
1605
    except:
1607
    except:
-
 
1608
        traceback.print_exc()
1606
        tinInfo = {"isError":True,
1609
        tinInfo = {"isError":True,
1607
                    "errorMsg": "Could not find tin"
1610
                    "errorMsg": "Could not find tin"
1608
        }
1611
        }
1609
        print "TinNumber: Problem fetching details", tin
1612
        print "TinNumber: Problem fetching details", tin
1610
    return tinInfo
1613
    return tinInfo
Line 2267... Line 2270...
2267
    print json.dumps(todict(getRetailerObj(retailer, otherContacts, 'fresh')), encoding='utf-8')
2270
    print json.dumps(todict(getRetailerObj(retailer, otherContacts, 'fresh')), encoding='utf-8')
2268
#     a = GetUserCrmApplication()
2271
#     a = GetUserCrmApplication()
2269
#     a.getUser("accs_active", 2)
2272
#     a.getUser("accs_active", 2)
2270
    
2273
    
2271
if __name__ == '__main__':
2274
if __name__ == '__main__':
2272
    main()
2275
    #main()
-
 
2276
    print getTinInfo('07976957280')
2273
        
2277
        
2274
2278