Created
December 23, 2014 02:48
-
-
Save drmarshall/c2b1bb2eb405938b20ee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# extending the Mixpanel API class for large data to avoid maxing out ram and slowing request to point of failure | |
def request_highvolume(self, methods, params): | |
""" | |
methods - List of methods to be joined, e.g. ['events', 'properties', 'values'] | |
will give us http://mixpanel.com/api/2.0/events/properties/values/ | |
params - Extra parameters associated with method | |
""" | |
params['api_key'] = self.api_key | |
params['expire'] = int(time.time()) + 600 # Grant this request 10 minutes. | |
if 'sig' in params: del params['sig'] | |
params['sig'] = self.hash_args(params) | |
request_url = '/'.join([self.ENDPOINT, str(self.VERSION)] + methods) + '/?' + self.unicode_urlencode(params) | |
request = urllib.urlretrieve(request_url, output_file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment