buakakakak *evil mode
#!/usr/bin/python import codecs, os.path, urllib, urllib2, time, base64, sys ####################################### # follow http://twitter.com/eiween for more help >:) # my blog http://rootaddict.tk # my community http://gxrg.org username='username_here' password='password_here' venue = id_venue_here def checkk(endpoint, username, password, params, post): query_url='http://api.foursquare.com/v1/'+endpoint+'.json' if not post: if params: data = urllib.urlencode(params) request = urllib2.Request('%s?%s' % (query_url, data) ) else: request = urllib2.Request(query_url) else: if params: data = urllib.urlencode(params) request = urllib2.Request(query_url, data) else: request = urllib2.Request(query_url) b64 = base64.encodestring('%s:%s' % (username, password))[:-1] authheader="Basic %s" % b64 request.add_header('Authorization', authheader) try: result = urllib2.urlopen(request) except IOError, e: print 'error' return def checkin(username, password, **kwargs): if kwargs.has_key('vid') or kwargs.has_key('venue') or kwargs.has_key('shout'): result = checkk('checkin', username=username, password=password, params=kwargs, post=True) # checkin(username,password,vid=venue)
Tidak ada komentar:
Posting Komentar