{"action":"created","issue":{"url":"https://api.github.com/repos/lambertwang/ctct-python-sdk/issues/7","repository_url":"https://api.github.com/repos/lambertwang/ctct-python-sdk","labels_url":"https://api.github.com/repos/lambertwang/ctct-python-sdk/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/lambertwang/ctct-python-sdk/issues/7/comments","events_url":"https://api.github.com/repos/lambertwang/ctct-python-sdk/issues/7/events","html_url":"https://github.com/lambertwang/ctct-python-sdk/issues/7","id":332528105,"node_id":"MDU6SXNzdWUzMzI1MjgxMDU=","number":7,"title":"processing pagination from Activity Tracking","user":{"login":"shaunisspatial","id":40276530,"node_id":"MDQ6VXNlcjQwMjc2NTMw","avatar_url":"https://avatars1.githubusercontent.com/u/40276530?v=4","gravatar_id":"","url":"https://api.github.com/users/shaunisspatial","html_url":"https://github.com/shaunisspatial","followers_url":"https://api.github.com/users/shaunisspatial/followers","following_url":"https://api.github.com/users/shaunisspatial/following{/other_user}","gists_url":"https://api.github.com/users/shaunisspatial/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunisspatial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunisspatial/subscriptions","organizations_url":"https://api.github.com/users/shaunisspatial/orgs","repos_url":"https://api.github.com/users/shaunisspatial/repos","events_url":"https://api.github.com/users/shaunisspatial/events{/privacy}","received_events_url":"https://api.github.com/users/shaunisspatial/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-14T19:10:03Z","updated_at":"2018-06-15T17:10:25Z","closed_at":"2018-06-15T17:10:13Z","author_association":"NONE","body":"First time reporting an issue, so please let me know if i'm incorrect. \r\nWhen requesting campaign opens and calling .get_next_page(), baseservice seems to have an issue at line 110 where it's looking for tracking_response, which doesn't exist. \r\n**Call**\r\n```python\r\nctct = ConstantContact(apiKey, accessToken)\r\ncampaign = ctct.get_campaign(campaign_id= test_campaign_id)\r\nresponse = ctct.get_campaign_opens(campaign)\r\nnext = response.get_next_page()\r\nresponse_next = ctct.next_page(next)\r\n```\r\nError returned: \"NameError: name 'tracking_response' is not defined\"\r\n\r\n**base service**\r\n```python\r\n    # The url from the pagination data can be directly passed into this method\r\n    # Pagination is returned from the api in the form /v2/{service}?next={uuid}\r\n    def next_page(self, url):\r\n        service = url.split('/', 2)[2].split('?', 1)[0]\r\n        url = self.base_url + '/' + url.split('/', 2)[2]\r\n        \r\n        # Set the api key for pagination request\r\n        params = {'api_key': self.client_id}\r\n\r\n        response = requests.get(url, headers=self.header, params = params)\r\n\r\n        try:\r\n            response = response if response is None else json.loads(response.content.decode('utf8'))\r\n        except:\r\n            pass\r\n        # Check if an error message key pair is returned\r\n        try:\r\n            if response[0]['error_message']:\r\n                response = response[0]\r\n        except:\r\n            # Parse response into a resultset\r\n            if service == 'contacts':\r\n                for i in range(len(response['results'])):\r\n                    response['results'][i] = Contact(response['results'][i])\r\n            elif service == 'emailmarketing/campaigns':\r\n                for i in range(len(response['results'])):\r\n                    response['results'][i] = Campaign(response['results'][i])\r\n            elif service.split('/', 1)[0] == 'lists':\r\n                for i in range(len(response['results'])):\r\n                    response['results'][i] = Contact(response['results'][i])\r\n            elif service.split('/')[2] == 'tracking':\r\n                # Contact tracking\r\n                for i in range(len(response['results'])):\r\n                    response['results'][i] = Activity_Report(tracking_response['results'][i])\r\n            elif service.split('/')[3] == 'tracking':\r\n                # Email campaign tracking\r\n                for i in range(len(response['results'])):\r\n                    response['results'][i] = Activity_Report(tracking_response['results'][i])\r\n```\r\n\r\n\r\nI changed tracking_response to response at line 110 locally and it seemed to resolve the issue and returned a result set. "},"comment":{"url":"https://api.github.com/repos/lambertwang/ctct-python-sdk/issues/comments/397685485","html_url":"https://github.com/lambertwang/ctct-python-sdk/issues/7#issuecomment-397685485","issue_url":"https://api.github.com/repos/lambertwang/ctct-python-sdk/issues/7","id":397685485,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzY4NTQ4NQ==","user":{"login":"lambertwang","id":6496608,"node_id":"MDQ6VXNlcjY0OTY2MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/6496608?v=4","gravatar_id":"","url":"https://api.github.com/users/lambertwang","html_url":"https://github.com/lambertwang","followers_url":"https://api.github.com/users/lambertwang/followers","following_url":"https://api.github.com/users/lambertwang/following{/other_user}","gists_url":"https://api.github.com/users/lambertwang/gists{/gist_id}","starred_url":"https://api.github.com/users/lambertwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lambertwang/subscriptions","organizations_url":"https://api.github.com/users/lambertwang/orgs","repos_url":"https://api.github.com/users/lambertwang/repos","events_url":"https://api.github.com/users/lambertwang/events{/privacy}","received_events_url":"https://api.github.com/users/lambertwang/received_events","type":"User","site_admin":false},"created_at":"2018-06-15T17:10:25Z","updated_at":"2018-06-15T17:10:25Z","author_association":"OWNER","body":"Fix published in version `0.3.4`."}}
{"actor":{"display_login":"lambertwang"}}