Skip to content

Instantly share code, notes, and snippets.

@songxiaofeng1981
Created November 23, 2012 01:25
Show Gist options
  • Save songxiaofeng1981/4133593 to your computer and use it in GitHub Desktop.
Save songxiaofeng1981/4133593 to your computer and use it in GitHub Desktop.
python:getChannelIDs
#!/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