-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow any Associative as a header #132
Conversation
I could add some tests explicitly for this but most likely I would need to add a test requirement on DataStructures.jl to use an |
I wonder if we even leave off |
I have a WIP experimental branch where I've replaced the internal representation of the headers with a |
Looks like this is still an issue: Lines 39 to 45 in f9837eb
|
Sorry for the confusion, the The new doc says: Lines 41 to 43 in f9837eb
The top-level Lines 293 to 301 in f9837eb
Line 197 in f9837eb
|
Ah ok. If the |
FYI I managed to make a small test to demonstrate the issue (It appears that not all julia> using HTTP, PyCall
julia> @pyimport requests
julia> r = requests.get("http://httpbin.org/xml")
PyObject <Response [200]>
julia> h = PyDict(r[:request][:headers])
PyCall.PyDict{PyCall.PyAny,PyCall.PyAny,false} with 4 entries:
"Connection" => "keep-alive"
"Accept-Encoding" => "gzip, deflate"
"Accept" => "*/*"
"User-Agent" => "python-requests/2.18.4"
julia> HTTP.get("http://httpbin.org/xml", headers=h)
ERROR: TypeError: #request: in typeassert, expected Dict, got PyCall.PyDict{PyCall.PyAny,PyCall.PyAny,false}
Stacktrace:
[1] (::HTTP.#kw##request)(::Array{Any,1}, ::HTTP.#request, ::HTTP.Client, ::String, ::HTTP.URIs.URI) at ./<missing>:0
[2] #get#23(::Array{Any,1}, ::Function, ::String) at /Users/omus/.julia/v0.6/HTTP/src/client.jl:144
[3] (::HTTP.#kw##get)(::Array{Any,1}, ::HTTP.#get, ::String) at ./<missing>:0 When I use the positional parameter the request works as expected: julia> HTTP.get("http://httpbin.org/xml", h)
HTTP.Messages.Response:
"""
HTTP/1.1 200 OK
...
""" |
No, its not deprecated: Lines 293 to 294 in f9837eb
Are you using latest master? This commit ought to fix that problem: b5844b1 |
The keyword works on the latest master. |
Why do we support headers as a positional and keyword parameter? If this has been discussed elsewhere could you point me to the discussion? |
Allows alternative
Dict
types such asPyCall.PyDict
to be used as a header.