AttributeError: 'unicode' object has no attribute 'items' Windows incompatbility
See original GitHub issueThere seems to be an incompatibility between the Create Session keyword and later being used by the Get Request keyword when run on a windows environment. Below is the test case:
Setup Suite Create Session mysession ${BASE_URL}
Test Member Endpoint Default Functionality
[Documentation] Tests the /api/member servlet to check service status
Verify MSV Inserter Member Servlet In Normal Mode
Verify Member Servlet in Normal Mode [Documentation] Calls the /api/member servlet to check for a 200 status and status:up [Arguments] ${alias} ${resp}= Get Request ${alias} ${MEMBER_PATH} timeout=5 Should be Equal As Numbers ${resp.status_code} 200 [return] ${resp}
Linux results:
==============================================================================
20170303 09:40:10.733 - INFO - +--- START SETUP: BuiltIn.Run Keywords [ Setup Suite ]
20170303 09:40:10.733 - INFO - +---- START KW: Setup Suite [ ]
20170303 09:40:10.734 - INFO - +----- START KW: RequestsLibrary.Create Session [ mysession | ${BASE_URL} ]
20170303 09:40:10.734 - INFO - Creating Session using : alias=mysession, url=http://192.168.215.148:8180/, headers={}, cookies=None, auth=None, timeout=None, proxies=None, verify=False, debug=0
20170303 09:40:10.735 - DEBUG - Creating session: mysession
20170303 09:40:10.735 - DEBUG - Argument types are:
<type 'bool'>
20170303 09:40:10.735 - INFO - +----- END KW: RequestsLibrary.Create Session (1)
20170303 09:40:10.736 - INFO - +----- START KW: BuiltIn.Log [ Setup Suite | DEBUG ]
20170303 09:40:10.736 - DEBUG - Setup Suite
20170303 09:40:10.736 - INFO - +----- END KW: BuiltIn.Log (0)
20170303 09:40:10.736 - INFO - +---- END KW: Setup Suite (3)
20170303 09:40:10.737 - INFO - +--- END SETUP: BuiltIn.Run Keywords (4)
------------------------------------------------------------------------------
20170303 09:40:10.737 - INFO - +--- START TEST: Test Member Endpoint Default Functionality [ ]
------------------------------------------------------------------------------
20170303 09:40:10.738 - INFO - +---- START KW: Verify Member Servlet In Normal Mode [ ]
20170303 09:40:10.739 - INFO - +----- START KW: resource_member_servlet.Verify Member Servlet in Normal Mode [ mysession ]
20170303 09:40:10.740 - INFO - +------ START KW: RequestsLibrary.Get Request [ ${alias} | ${MEMBER_PATH} | timeout=5 ]
20170303 09:40:10.764 - INFO - Get Request using : alias=mysession, uri=/api/member, headers=None
20170303 09:40:10.767 - INFO - ${resp} = <Response [200]>
20170303 09:40:10.767 - INFO - +------ END KW: RequestsLibrary.Get Request (27)
20170303 09:40:10.767 - INFO - +------ START KW: BuiltIn.Should Be Equal As Numbers [ ${resp.status_code} | 200 ]
20170303 09:40:10.768 - INFO - Argument types are:
<type 'int'>
<type 'unicode'>
20170303 09:40:10.768 - INFO - +------ END KW: BuiltIn.Should Be Equal As Numbers (1)
Windows Result
==============================================================================
20170303 09:39:54.244 - INFO - +--- START SETUP: BuiltIn.Run Keywords [ Setup Suite ]
20170303 09:39:54.245 - INFO - +---- START KW: Setup Suite [ ]
20170303 09:39:54.246 - INFO - +----- START KW: RequestsLibrary.Create Session [ mysession | ${BASE_URL} ]
20170303 09:39:54.246 - INFO - Creating Session using : alias=mysession, url=http://192.168.215.148:8180/, headers={}, cookies=None, auth=None, timeout=None, proxies=None, verify=False
20170303 09:39:54.246 - DEBUG - Creating session: mysession
20170303 09:39:54.247 - DEBUG - Argument types are:
<type 'bool'>
20170303 09:39:54.247 - INFO - +----- END KW: RequestsLibrary.Create Session (1)
20170303 09:39:54.247 - INFO - +----- START KW: BuiltIn.Log [ Setup Suite | DEBUG ]
20170303 09:39:54.248 - DEBUG - Setup Suite
20170303 09:39:54.248 - INFO - +----- END KW: BuiltIn.Log (1)
20170303 09:39:54.248 - INFO - +---- END KW: Setup Suite (3)
20170303 09:39:54.248 - INFO - +--- END SETUP: BuiltIn.Run Keywords (4)
------------------------------------------------------------------------------
20170303 09:39:54.249 - INFO - +--- START TEST: Test Member Endpoint Default Functionality [ ]
------------------------------------------------------------------------------
20170303 09:39:54.251 - INFO - +---- START KW: Verify Member Servlet In Normal Mode [ ]
20170303 09:39:54.252 - INFO - +----- START KW: resource_member_servlet.Verify Member Servlet in Normal Mode [ mysession ]
20170303 09:39:54.253 - INFO - +------ START KW: RequestsLibrary.Get Request [ ${alias} | ${MEMBER_PATH} | timeout=5 ]
20170303 09:39:54.258 - FAIL - AttributeError: 'unicode' object has no attribute 'items'
20170303 09:39:54.258 - DEBUG - Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\RequestsLibrary\RequestsKeywords.py", line 172, in get_request
response = self._get_request(session, uri, headers, params, redir)
File "C:\Python27\Lib\site-packages\RequestsLibrary\RequestsKeywords.py", line 473, in _get_request
allow_redirects=allow_redirects)
File "C:\Python27\Lib\site-packages\requests\sessions.py", line 487, in get
return self.request('GET', url, **kwargs)
File "C:\Python27\Lib\site-packages\requests\sessions.py", line 461, in request
prep = self.prepare_request(req)
File "C:\Python27\Lib\site-packages\requests\sessions.py", line 394, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "C:\Python27\Lib\site-packages\requests\models.py", line 296, in prepare
self.prepare_headers(headers)
File "C:\Python27\Lib\site-packages\requests\models.py", line 407, in prepare_headers
self.headers = CaseInsensitiveDict((to_native_string(name), value) for name, value in headers.items())
20170303 09:39:54.258 - INFO - +------ END KW: RequestsLibrary.Get Request (5)
20170303 09:39:54.258 - INFO - +----- END KW: resource_member_servlet.Verify Member Servlet in Normal Mode (6)
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
AttributeError: 'unicode' object has no attribute 'items' Windows ...
There seems to be an incompatibility between the Create Session keyword and later being used by the Get Request keyword when run on...
Read more >'Unicode' object has no attribute 'items' - Stack Overflow
In my case (youtube-dl), using python3 instead of python2 solved it. Maybe one of the involved .py files just uses a python3-ism.
Read more >AttributeError: 'unicode' object has no attribute 'items' - Reddit
The problem is I get the error code " AttributeError: 'unicode' object has no attribute 'items'" when I use --cookies.
Read more >List of messages - Issue Tracker - Python.org
13101 Author: gvanrossum Date: 2003‑01‑31.21:07:57
13102 Author: gaumann Date: 2002‑11‑06.04:14:51
13103 Author: doerwalter Date: 2002‑11‑06.15:26:18
13104 Author: lemburg Date: 2002‑11‑06.16:39:25
Read more >I'm getting the error message AttributeError: 'unicode object ...
I'm getting the error message AttributeError: 'unicode object has no attribute 'XXXX'¶. This type of error is usually caused by a naming conflict....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Passes with robotframework-requests 0.4.6. Apologies…must have a hard-coded version someplace.
hmm, I upgraded all the packages still my testcases are green
my packages are and also i see you are using
robotframework-requests==0.3.5
could you try to upgradepip install --upgrade robotframework-requests
I having fallowing packages, the above test is working fine.