Lines Matching full:headers
70 def _initialize_headers(headers): argument
71 """Creates a copy of the headers.
74 headers: dict, request headers to copy.
77 dict, the copied headers or a new dictionary if the headers
80 return {} if headers is None else dict(headers)
83 def _apply_user_agent(headers, user_agent): argument
84 """Adds a user-agent to the headers.
87 headers: dict, request headers to add / modify user
92 dict, the original headers passed in, but modified if the
96 if 'user-agent' in headers:
97 headers['user-agent'] = (user_agent + ' ' + headers['user-agent'])
99 headers['user-agent'] = user_agent
101 return headers
104 def clean_headers(headers): argument
112 headers: dict, A dictionary of headers.
119 for k, v in six.iteritems(headers):
147 def new_request(uri, method='GET', body=None, headers=None, argument
155 # Clone and modify the request headers to add the appropriate
157 headers = _initialize_headers(headers)
158 credentials.apply(headers)
159 _apply_user_agent(headers, credentials.user_agent)
168 clean_headers(headers),
181 credentials.apply(headers)
186 clean_headers(headers),
217 def new_request(uri, method='GET', body=None, headers=None, argument
226 headers, redirections,
231 headers = _initialize_headers(headers)
232 _apply_user_agent(headers, credentials.user_agent)
236 headers['Authorization'] = 'Bearer ' + token
238 clean_headers(headers),