{"action":"created","issue":{"url":"https://api.github.com/repos/betamaxpy/betamax/issues/165","repository_url":"https://api.github.com/repos/betamaxpy/betamax","labels_url":"https://api.github.com/repos/betamaxpy/betamax/issues/165/labels{/name}","comments_url":"https://api.github.com/repos/betamaxpy/betamax/issues/165/comments","events_url":"https://api.github.com/repos/betamaxpy/betamax/issues/165/events","html_url":"https://github.com/betamaxpy/betamax/issues/165","id":393350780,"node_id":"MDU6SXNzdWUzOTMzNTA3ODA=","number":165,"title":"How to retry request and store response of that retried request in cassette","user":{"login":"GunjanSkry","id":31774510,"node_id":"MDQ6VXNlcjMxNzc0NTEw","avatar_url":"https://avatars0.githubusercontent.com/u/31774510?v=4","gravatar_id":"","url":"https://api.github.com/users/GunjanSkry","html_url":"https://github.com/GunjanSkry","followers_url":"https://api.github.com/users/GunjanSkry/followers","following_url":"https://api.github.com/users/GunjanSkry/following{/other_user}","gists_url":"https://api.github.com/users/GunjanSkry/gists{/gist_id}","starred_url":"https://api.github.com/users/GunjanSkry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GunjanSkry/subscriptions","organizations_url":"https://api.github.com/users/GunjanSkry/orgs","repos_url":"https://api.github.com/users/GunjanSkry/repos","events_url":"https://api.github.com/users/GunjanSkry/events{/privacy}","received_events_url":"https://api.github.com/users/GunjanSkry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-21T07:35:54Z","updated_at":"2018-12-24T06:11:35Z","closed_at":null,"author_association":"NONE","body":"How to retry request in below example:\r\n\r\n```from betamax import Betamax\r\nfrom betamax.fixtures.unittest import BetamaxTestCase\r\n\r\n\r\nwith Betamax.configure() as config:\r\n    config.cassette_library_dir = 'cassettes'\r\n    config.preserve_exact_body_bytes = True\r\n\r\n\r\nclass TestExample(BetamaxTestCase): \r\n\r\n    def test_parse(self):\r\n        example = Example()\r\n\r\n        # How to retry below request 4 time\r\n        response = self.session.get(example.url)```\r\n"},"comment":{"url":"https://api.github.com/repos/betamaxpy/betamax/issues/comments/449690812","html_url":"https://github.com/betamaxpy/betamax/issues/165#issuecomment-449690812","issue_url":"https://api.github.com/repos/betamaxpy/betamax/issues/165","id":449690812,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTY5MDgxMg==","user":{"login":"GunjanSkry","id":31774510,"node_id":"MDQ6VXNlcjMxNzc0NTEw","avatar_url":"https://avatars0.githubusercontent.com/u/31774510?v=4","gravatar_id":"","url":"https://api.github.com/users/GunjanSkry","html_url":"https://github.com/GunjanSkry","followers_url":"https://api.github.com/users/GunjanSkry/followers","following_url":"https://api.github.com/users/GunjanSkry/following{/other_user}","gists_url":"https://api.github.com/users/GunjanSkry/gists{/gist_id}","starred_url":"https://api.github.com/users/GunjanSkry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GunjanSkry/subscriptions","organizations_url":"https://api.github.com/users/GunjanSkry/orgs","repos_url":"https://api.github.com/users/GunjanSkry/repos","events_url":"https://api.github.com/users/GunjanSkry/events{/privacy}","received_events_url":"https://api.github.com/users/GunjanSkry/received_events","type":"User","site_admin":false},"created_at":"2018-12-24T06:11:35Z","updated_at":"2018-12-24T06:11:35Z","author_association":"NONE","body":"I want to retry the request if it fails and for that, I've done like below\r\n\r\n```\r\nfrom betamax.fixtures.unittest import BetamaxTestCase\r\nimport requests\r\n\r\n\r\nwith Betamax.configure() as config:\r\n    config.cassette_library_dir = 'cassettes'\r\n    config.preserve_exact_body_bytes = True\r\n\r\n\r\nclass TestExample(BetamaxTestCase): \r\n\r\n    def test_parse(self):\r\n        example = Example()\r\n        \r\n        adapter = requests.adapters.HTTPAdapter(max_retries = 5)\r\n        \r\n        self.session.mount('http://', adapter)\r\n        self.session.mount('https://', adapter)\r\n\r\n        response = self.session.get(example.url)\r\n```\r\nBut it doesn't store the response of the get request in cassette, The json file generated by this looks like below,\r\n```\r\n{\"http_interactions\": [], \"recorded_with\": \"betamax/0.8.1\"}\r\n```\r\nI've also tried \"BetamaxAdapter\" like below, \r\n```\r\nfrom betamax.fixtures.unittest import BetamaxTestCase\r\nfrom betamax.adapter import BetamaxAdapter\r\n\r\n\r\nwith Betamax.configure() as config:\r\n    config.cassette_library_dir = 'cassettes'\r\n    config.preserve_exact_body_bytes = True\r\n\r\n\r\nclass TestExample(BetamaxTestCase): \r\n\r\n    def test_parse(self):\r\n        example = Example()\r\n        \r\n        adapter = BetamaxAdapter(max_retries=5)\r\n        \r\n        self.session.mount('http://', adapter)\r\n        self.session.mount('https://', adapter)\r\n\r\n        response = self.session.get(example.url)\r\n```\r\nBut it gave me this error\r\n```File \"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/sessions.py\", line 546, in get\r\n    return self.request('GET', url, **kwargs)\r\n  File \"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/sessions.py\", line 533, in request\r\n    resp = self.send(prep, **send_kwargs)\r\n  File \"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/sessions.py\", line 646, in send\r\n    r = adapter.send(request, **kwargs)\r\n  File \"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/betamax/adapter.py\", line 120, in send\r\n    raise BetamaxError('No cassette was specified or found.')\r\nbetamax.exceptions.BetamaxError: No cassette was specified or found.\r\n```"}}
{"actor":{"display_login":"GunjanSkry"}}