Created
November 23, 2012 01:25
-
-
Save songxiaofeng1981/4133593 to your computer and use it in GitHub Desktop.
python:getChannelIDs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib2 | |
import json | |
def get_channels(): | |
channels = set() | |
url = "http://rcmsapi.chinacache.com:36000/customer/24quan/channels" | |
opener = urllib2.urlopen(url) | |
for record in json.loads(opener.read()): | |
if(record['productCode']=='1'): | |
print record | |
channels.add("%s %s\n" % (record[u'name'].split('://')[1], record[u'code'])) | |
# print channels | |
if __name__ == '__main__' : | |
get_channels() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment