0
class FourSquareTestHandler(SecurePageHandler):
def get(self):
logging.info('***********************')
logging.info('*****GET****')
logging.info('***********************')
try:
request =\
urllib2.Request('https://api.foursquare.com/v2/users/self/checkins?oauth_token=LAF1W3VMSI0DGQYIBTNIYVIZG4VE2RFGESM45LDJRSQHFTK3&v=20120123')
data = simplejson.load(urllib2.urlopen(request))
logging.info('=========================')
logging.info('*********Success*********')
logging.info('=========================')
logging.info(data)
logging.info('======================================')
except Exception:
logging.info('**********EXCEPTION*********')
pass
context = {}
return self.render_response('foursquaretest.html', **context)
こんにちは、私はこのコードを書いてユーザーのチェックイン数を得ました。私は、私のためにシンプルなデシリアライズされたデータオブジェクトを取得することができます。私は現在、ええと、このpythonでfoursquareから与えられたユーザーIDのユーザーチェックインを取得する方法
{
u 'notifications': [{
u 'item': {
u 'unreadCount': 0
},
u 'type': u 'notificationTray'
}],
u 'meta': {
u 'code': 200
},
u 'response': {
u 'checkins': {
u 'count': 6,
u 'items': [{
u 'venue': {
u 'verified': False,
u 'name': u 'ODEL Warehouse',
u 'contact': {},
u 'location': {
u 'city': u 'Colombo',
u 'country': u 'Sri Lanka',
u 'postalCode': u '00600',
u 'state': u 'Western Province',
u 'address': u 'Highlevel Rd',
u 'lat': 6.8754399960498391,
u 'lng': 79.881239696240982
},
u 'stats': {
u 'tipCount': 2,
u 'checkinsCount': 76,
u 'usersCount': 25
},
u 'id': u '4d217410b69c6dcbf1787995',
u 'categories': []
},
u 'comments': {
u 'count': 0,
u 'items': []
},
u 'photos': {
u 'count': 0,
u 'items': []
},
u 'timeZone': u 'Asia/Colombo',
u 'type': u 'checkin',
u 'id': u '4f1d1940e4b0d1a657597d73',
u 'createdAt': 1327307072
}, {
u 'venue': {
u 'verified': False,
u 'name': u 'Chesmi Consolidated',
u 'contact': {},
u 'location': {
u 'lat': 6.8783062620154825,
u 'city': u 'colombo 5',
u 'lng': 79.879610192565167,
u 'country': u 'Sri Lanka',
u 'address': u '21, Siebel Avenue,'
},
u 'stats': {
u 'tipCount': 0,
u 'checkinsCount': 2,
u 'usersCount': 2
},
u 'id': u '4ed4cab6e5fa7b1a923b1e1e',
u 'categories': []
},
u 'comments': {
u 'count': 0,
u 'items': []
},
u 'photos': {
u 'count': 0,
u 'items': []
},
u 'timeZone': u 'Asia/Colombo',
u 'type': u 'checkin',
u 'id': u '4f1d1920e4b0e6badd487a53',
u 'createdAt': 1327307040
}, {
u 'venue': {
u 'verified': False,
u 'name': u 'Commercial Bank',
u 'contact': {},
u 'location': {
u 'city': u 'Colombo 5',
u 'country': u 'Sri Lanka',
u 'postalCode': u '00500',
u 'state': u 'Western Province',
u 'address': u 'High Level Rd',
u 'lat': 6.8776848396168955,
u 'lng': 79.879610192565167
},
u 'stats': {
u 'tipCount': 0,
u 'checkinsCount': 42,
u 'usersCount': 9
},
u 'id': u '4c85bdb1d4e237047aaf8588',
u 'categories': [{
u 'pluralName': u 'Banks',
u 'primary': True,
u 'name': u 'Bank',
u 'shortName': u 'Bank/Financial',
u 'id': u '4bf58dd8d48988d10a951735',
u 'icon': {
u 'prefix': u 'https://foursquare.com/img/categories/shops/financial_',
u 'name': u '.png',
u 'sizes': [32, 44, 64, 88, 256]
}
}]
},
u 'comments': {
u 'count': 0,
u 'items': []
},
u 'photos': {
u 'count': 0,
u 'items': []
},
u 'timeZone': u 'Asia/Colombo',
u 'type': u 'checkin',
u 'id': u '4f1d18f5e4b0e6badd485953',
u 'createdAt': 1327306997
}, {
u 'venue': {
u 'verified': False,
u 'name': u 'Siebel Avenue Bus Stop 138',
u 'contact': {},
u 'location': {
u 'lat': 6.8775550799999996,
u 'country': u 'Sri Lanka',
u 'lng': 79.879341159999996
},
u 'stats': {
u 'tipCount': 3,
u 'checkinsCount': 76,
u 'usersCount': 15
},
u 'id': u '4e5c53b345dd045aab4d7dfa',
u 'categories': [{
u 'pluralName': u 'Bus Stations',
u 'primary': True,
u 'name': u 'Bus Station',
u 'shortName': u 'Bus Station',
u 'id': u '4bf58dd8d48988d1fe931735',
u 'icon': {
u 'prefix': u 'https://foursquare.com/img/categories/travel/busstation_',
u 'name': u '.png',
u 'sizes': [32, 44, 64, 88, 256]
}
}]
},
u 'comments': {
u 'count': 0,
u 'items': []
},
u 'photos': {
u 'count': 0,
u 'items': []
},
u 'timeZone': u 'Asia/Colombo',
u 'type': u 'checkin',
u 'id': u '4f1d18e1e4b0e2eeed04eff2',
u 'createdAt': 1327306977
}, {
u 'venue': {
u 'verified': False,
u 'name': u 'Visni',
u 'contact': {},
u 'location': {
u 'lat': 6.8785901069641113,
u 'country': u 'Sri Lanka',
u 'lng': 79.879791259765625
},
u 'stats': {
u 'tipCount': 1,
u 'checkinsCount': 8,
u 'usersCount': 1
},
u 'id': u '4eb75312f5b94bd85c9fa375',
u 'categories': [{
u 'pluralName': u 'Tech Startups',
u 'primary': True,
u 'name': u 'Tech Startup',
u 'shortName': u 'Tech Startup',
u 'id': u '4bf58dd8d48988d125941735',
u 'icon': {
u 'prefix': u 'https://foursquare.com/img/categories/shops/technology_',
u 'name': u '.png',
u 'sizes': [32, 44, 64, 88, 256]
}
}]
},
u 'comments': {
u 'count': 0,
u 'items': []
},
u 'photos': {
u 'count': 0,
u 'items': []
},
u 'timeZone': u 'Asia/Colombo',
u 'type': u 'checkin',
u 'id': u '4f1d18cde4b0850c85e124d1',
u 'createdAt': 1327306957
}, {
u 'venue': {
u 'verified': False,
u 'name': u 'Calcey Technologies',
u 'contact': {
u 'phone': u '0112827560',
u 'formattedPhone': u '011 2 827560'
},
u 'location': {
u 'city': u 'Colombo 5',
u 'country': u 'Sri Lanka',
u 'postalCode': u '00500',
u 'state': u 'Sri Lanka',
u 'crossStreet': u 'Highlevel Rd',
u 'address': u '21 Siebel Ave',
u 'lat': 6.8782598000000004,
u 'lng': 79.879707733333333
},
u 'stats': {
u 'tipCount': 0,
u 'checkinsCount': 324,
u 'usersCount': 14
},
u 'id': u '4c43efd62d3ec9b60e3f2eae',
u 'categories': [{
u 'pluralName': u 'Tech Startups',
u 'primary': True,
u 'name': u 'Tech Startup',
u 'shortName': u 'Tech Startup',
u 'id': u '4bf58dd8d48988d125941735',
u 'icon': {
u 'prefix': u 'https://foursquare.com/img/categories/shops/technology_',
u 'name': u '.png',
u 'sizes': [32, 44, 64, 88, 256]
}
}]
},
u 'comments': {
u 'count': 0,
u 'items': []
},
u 'photos': {
u 'count': 0,
u 'items': []
},
u 'timeZone': u 'Asia/Colombo',
u 'type': u 'checkin',
u 'id': u '4f1d18a3e4b0a6271ab6c175',
u 'createdAt': 1327306915
}]
}
}
}
@Hugo、この編集は質問を大きく変えます。質問者は、このような形式の質問を書くことができるかどうかこの質問をしなかった)。 質問を編集するのではなく、その書式を別の回答として入力する必要があります。 – 0xc0de