{"action":"created","issue":{"url":"https://api.github.com/repos/requests/requests/issues/3803","repository_url":"https://api.github.com/repos/requests/requests","labels_url":"https://api.github.com/repos/requests/requests/issues/3803/labels{/name}","comments_url":"https://api.github.com/repos/requests/requests/issues/3803/comments","events_url":"https://api.github.com/repos/requests/requests/issues/3803/events","html_url":"https://github.com/requests/requests/issues/3803","id":199635105,"number":3803,"title":"AttributeError: 'set' object has no attribute 'items'","user":{"login":"codespaced","id":911902,"avatar_url":"https://avatars3.githubusercontent.com/u/911902?v=4","gravatar_id":"","url":"https://api.github.com/users/codespaced","html_url":"https://github.com/codespaced","followers_url":"https://api.github.com/users/codespaced/followers","following_url":"https://api.github.com/users/codespaced/following{/other_user}","gists_url":"https://api.github.com/users/codespaced/gists{/gist_id}","starred_url":"https://api.github.com/users/codespaced/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codespaced/subscriptions","organizations_url":"https://api.github.com/users/codespaced/orgs","repos_url":"https://api.github.com/users/codespaced/repos","events_url":"https://api.github.com/users/codespaced/events{/privacy}","received_events_url":"https://api.github.com/users/codespaced/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-01-09T19:05:36Z","updated_at":"2018-04-07T17:08:52Z","closed_at":"2017-01-09T19:41:40Z","author_association":"NONE","body":"fresh pip install requests. version 2.12.4. This works in postman.\r\n\r\n```\r\nimport requests\r\nurl = 'https://api.spotify.com/v1/audio-analysis/4JpKVNYnVcJ8tuMKjAj50A'\r\nheaders = {'Authorization', 'Bearer TOKEN-HERE'}\r\nr = requests.get(url, headers=headers)\r\n```\r\n```\r\n---------------------------------------------------------------------------\r\nAttributeError                            Traceback (most recent call last)\r\n<ipython-input-5-0b5138b50602> in <module>()\r\n      1 url = 'https://api.spotify.com/v1/audio-analysis/4JpKVNYnVcJ8tuMKjAj50A'\r\n      2 headers = {'Authorization', 'Bearer TOKEN-HERE'}\r\n----> 3 r = requests.get(url, headers=headers)\r\n\r\nc:\\python27\\lib\\site-packages\\requests\\api.pyc in get(url, params, **kwargs)\r\n     68 \r\n     69     kwargs.setdefault('allow_redirects', True)\r\n---> 70     return request('get', url, params=params, **kwargs)\r\n     71 \r\n     72 \r\n\r\nc:\\python27\\lib\\site-packages\\requests\\api.pyc in request(method, url, **kwargs)\r\n     54     # cases, and look like a memory leak in others.\r\n     55     with sessions.Session() as session:\r\n---> 56         return session.request(method=method, url=url, **kwargs)\r\n     57 \r\n     58 \r\n\r\nc:\\python27\\lib\\site-packages\\requests\\sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\r\n    472             hooks = hooks,\r\n    473         )\r\n--> 474         prep = self.prepare_request(req)\r\n    475 \r\n    476         proxies = proxies or {}\r\n\r\nc:\\python27\\lib\\site-packages\\requests\\sessions.pyc in prepare_request(self, request)\r\n    405             auth=merge_setting(auth, self.auth),\r\n    406             cookies=merged_cookies,\r\n--> 407             hooks=merge_hooks(request.hooks, self.hooks),\r\n    408         )\r\n    409         return p\r\n\r\nc:\\python27\\lib\\site-packages\\requests\\models.pyc in prepare(self, method, url, headers, files, data, params, auth, cookies, hooks, json)\r\n    301         self.prepare_method(method)\r\n    302         self.prepare_url(url, params)\r\n--> 303         self.prepare_headers(headers)\r\n    304         self.prepare_cookies(cookies)\r\n    305         self.prepare_body(data, files, json)\r\n\r\nc:\\python27\\lib\\site-packages\\requests\\models.pyc in prepare_headers(self, headers)\r\n    423         self.headers = CaseInsensitiveDict()\r\n    424         if headers:\r\n--> 425             for header in headers.items():\r\n    426                 # Raise exception on invalid header value.\r\n    427                 check_header_validity(header)\r\n\r\nAttributeError: 'set' object has no attribute 'items'\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/requests/requests/issues/comments/379484542","html_url":"https://github.com/requests/requests/issues/3803#issuecomment-379484542","issue_url":"https://api.github.com/repos/requests/requests/issues/3803","id":379484542,"user":{"login":"FraserChapman","id":1533832,"avatar_url":"https://avatars0.githubusercontent.com/u/1533832?v=4","gravatar_id":"","url":"https://api.github.com/users/FraserChapman","html_url":"https://github.com/FraserChapman","followers_url":"https://api.github.com/users/FraserChapman/followers","following_url":"https://api.github.com/users/FraserChapman/following{/other_user}","gists_url":"https://api.github.com/users/FraserChapman/gists{/gist_id}","starred_url":"https://api.github.com/users/FraserChapman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FraserChapman/subscriptions","organizations_url":"https://api.github.com/users/FraserChapman/orgs","repos_url":"https://api.github.com/users/FraserChapman/repos","events_url":"https://api.github.com/users/FraserChapman/events{/privacy}","received_events_url":"https://api.github.com/users/FraserChapman/received_events","type":"User","site_admin":false},"created_at":"2018-04-07T17:08:52Z","updated_at":"2018-04-07T17:08:52Z","author_association":"NONE","body":"The line\r\n\r\n`headers = {'Authorization', 'Bearer TOKEN-HERE'}`\r\n\r\nIs incorrect - it is a SET not a DICT - hence AttributeError: 'set' object has no attribute 'items' \r\n\r\nYou need \r\n\r\n`headers = {'Authorization': 'Bearer TOKEN-HERE'}`\r\n\r\nNotice **:** not **,** "}}
{"actor":{"display_login":"FraserChapman"}}