[PATCH cwclientlib] Replace usage of gone build_request_headers() by date_header_value in cwcompleter

Denis Laxalde denis.laxalde at logilab.fr
Tue Jun 12 09:22:28 CEST 2018


# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1528703069 -7200
#      Mon Jun 11 09:44:29 2018 +0200
# Node ID 5c6938d400123b6ebfde23b206d81b44a8c0ea8b
# Parent  6b2496e8a599926a39ae265db4c72f88f1671c68
# Available At http://hg.logilab.org/review/cwclientlib/
#              hg pull http://hg.logilab.org/review/cwclientlib/ -r 5c6938d40012
# EXP-Topic build-requests-headers-is-gone
Replace usage of gone build_request_headers() by date_header_value in cwcompleter

The former function got dropped in changeset 793a8b8450b1 but client
code in cwcompleter.py did not get updated.

diff --git a/cwclientlib/cwcompleter.py b/cwclientlib/cwcompleter.py
--- a/cwclientlib/cwcompleter.py
+++ b/cwclientlib/cwcompleter.py
@@ -31,7 +31,7 @@ import readline
 from rlcompleter import Completer
 import requests
 
-from cwclientlib.cwproxy import build_request_headers
+from cwclientlib.cwproxy import date_header_value
 
 
 class AbstractMatcher(object):
@@ -190,8 +190,12 @@ def get_suggestions(client, user_input):
         data = {'fname': 'rql_suggest',
                 'term': user_input,
                 }
+        headers = {
+            'Accept': 'application/json',
+            'Data': date_header_value(),
+        }
         sugg = requests.post(url=client.build_url('/json'),
-                             headers=build_request_headers(),
+                             headers=headers,
                              verify=client._ssl_verify,
                              auth=client.auth,
                              data=data).json()


More information about the cubicweb-devel mailing list