difference between curl and python requestsCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?How to get the current time in PythonDifference between __str__ and __repr__?Does Python have a string 'contains' substring method?
Dedicated to our #1 Fan
Why does the salt in the oceans not sink to the bottom?
How can I print a 1 cm overhang with minimal supports?
Is it OK to accept a job opportunity while planning on not taking it?
How can I show that the speed of light in vacuum is the same in all reference frames?
How can I calculate the cost of Skyss bus tickets
Are rockets faster than airplanes?
If hash functions append the length, why does length extension attack work?
Book in which the "mountain" in the distance was a hole in the flat world
How could Barty Crouch Jr. have run out of Polyjuice Potion at the end of the Goblet of Fire movie?
Found more old paper shares from broken up companies
Does downing a character at the start of its turn require an immediate Death Saving Throw?
Import data from a current web session?
Short story where a flexible reality hardens to an unchanging one
How can Kazakhstan perform MITM attacks on all HTTPS traffic?
Where is this photo of a group of hikers taken? Is it really in the Ural?
Wiring IKEA light fixture into old fixture
What kind of vegetable has pink and white concentric rings?
Is the apartment I want to rent a scam?
What is the best word describing the nature of expiring in a short amount of time, connoting "losing public attention"?
Pass USB 3.0 connection through D-SUB connector
Company requiring me to let them review research from before I was hired
Why are Oscar, India, and X-Ray (O, I, and X) not used as taxiway identifiers?
How does mathematics work?
difference between curl and python requests
Calling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?How to get the current time in PythonDifference between __str__ and __repr__?Does Python have a string 'contains' substring method?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to access my firewall API.
and i got a good answer in curl with:
curl -k -i -u admin:xxxx -X POST https://10.0.0.2:9443/api/sonicos/auth
#=> Ok
with requests, api said HTTP 406
here is my code:
import requests
from requests.auth import HTTPBasicAuth
r = requests.post(
'https://10.0.0.2:9443/api/sonicos/auth',
auth=HTTPBasicAuth('admin', 'xxxx'),
headers='Content-type': 'Application/JSON',
verify=False
)
API documentation said: 406 Not acceptable
Mime-type in content-type not supported.
I try a lot of parameters without success.
Any idea to help me?
Thanx
python python-requests
|
show 1 more comment
I am trying to access my firewall API.
and i got a good answer in curl with:
curl -k -i -u admin:xxxx -X POST https://10.0.0.2:9443/api/sonicos/auth
#=> Ok
with requests, api said HTTP 406
here is my code:
import requests
from requests.auth import HTTPBasicAuth
r = requests.post(
'https://10.0.0.2:9443/api/sonicos/auth',
auth=HTTPBasicAuth('admin', 'xxxx'),
headers='Content-type': 'Application/JSON',
verify=False
)
API documentation said: 406 Not acceptable
Mime-type in content-type not supported.
I try a lot of parameters without success.
Any idea to help me?
Thanx
python python-requests
Does the API docs says what kind of content-type it accepts?
– Stargazer
Mar 26 at 14:26
3
Why are you sending anapplication/json
content type?
– moritzg
Mar 26 at 14:28
With @moritzg. Especially since you aren't POSTing any data.
– Jared Smith
Mar 26 at 14:32
Henkq: uses two different content types for requests. Server: performs differently. Henkq: Pikachu face.
– Giacomo Alzetta
Mar 26 at 14:33
@Stargazer : API docs said mime-type accept application/json and text/plain
– Henkq
Mar 26 at 21:30
|
show 1 more comment
I am trying to access my firewall API.
and i got a good answer in curl with:
curl -k -i -u admin:xxxx -X POST https://10.0.0.2:9443/api/sonicos/auth
#=> Ok
with requests, api said HTTP 406
here is my code:
import requests
from requests.auth import HTTPBasicAuth
r = requests.post(
'https://10.0.0.2:9443/api/sonicos/auth',
auth=HTTPBasicAuth('admin', 'xxxx'),
headers='Content-type': 'Application/JSON',
verify=False
)
API documentation said: 406 Not acceptable
Mime-type in content-type not supported.
I try a lot of parameters without success.
Any idea to help me?
Thanx
python python-requests
I am trying to access my firewall API.
and i got a good answer in curl with:
curl -k -i -u admin:xxxx -X POST https://10.0.0.2:9443/api/sonicos/auth
#=> Ok
with requests, api said HTTP 406
here is my code:
import requests
from requests.auth import HTTPBasicAuth
r = requests.post(
'https://10.0.0.2:9443/api/sonicos/auth',
auth=HTTPBasicAuth('admin', 'xxxx'),
headers='Content-type': 'Application/JSON',
verify=False
)
API documentation said: 406 Not acceptable
Mime-type in content-type not supported.
I try a lot of parameters without success.
Any idea to help me?
Thanx
python python-requests
python python-requests
edited Mar 26 at 14:32
marmeladze
4,4563 gold badges14 silver badges33 bronze badges
4,4563 gold badges14 silver badges33 bronze badges
asked Mar 26 at 14:23
HenkqHenkq
12 bronze badges
12 bronze badges
Does the API docs says what kind of content-type it accepts?
– Stargazer
Mar 26 at 14:26
3
Why are you sending anapplication/json
content type?
– moritzg
Mar 26 at 14:28
With @moritzg. Especially since you aren't POSTing any data.
– Jared Smith
Mar 26 at 14:32
Henkq: uses two different content types for requests. Server: performs differently. Henkq: Pikachu face.
– Giacomo Alzetta
Mar 26 at 14:33
@Stargazer : API docs said mime-type accept application/json and text/plain
– Henkq
Mar 26 at 21:30
|
show 1 more comment
Does the API docs says what kind of content-type it accepts?
– Stargazer
Mar 26 at 14:26
3
Why are you sending anapplication/json
content type?
– moritzg
Mar 26 at 14:28
With @moritzg. Especially since you aren't POSTing any data.
– Jared Smith
Mar 26 at 14:32
Henkq: uses two different content types for requests. Server: performs differently. Henkq: Pikachu face.
– Giacomo Alzetta
Mar 26 at 14:33
@Stargazer : API docs said mime-type accept application/json and text/plain
– Henkq
Mar 26 at 21:30
Does the API docs says what kind of content-type it accepts?
– Stargazer
Mar 26 at 14:26
Does the API docs says what kind of content-type it accepts?
– Stargazer
Mar 26 at 14:26
3
3
Why are you sending an
application/json
content type?– moritzg
Mar 26 at 14:28
Why are you sending an
application/json
content type?– moritzg
Mar 26 at 14:28
With @moritzg. Especially since you aren't POSTing any data.
– Jared Smith
Mar 26 at 14:32
With @moritzg. Especially since you aren't POSTing any data.
– Jared Smith
Mar 26 at 14:32
Henkq: uses two different content types for requests. Server: performs differently. Henkq: Pikachu face.
– Giacomo Alzetta
Mar 26 at 14:33
Henkq: uses two different content types for requests. Server: performs differently. Henkq: Pikachu face.
– Giacomo Alzetta
Mar 26 at 14:33
@Stargazer : API docs said mime-type accept application/json and text/plain
– Henkq
Mar 26 at 21:30
@Stargazer : API docs said mime-type accept application/json and text/plain
– Henkq
Mar 26 at 21:30
|
show 1 more comment
1 Answer
1
active
oldest
votes
As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"
1
This is correct and valuable, but doesn't actually answer the question. It should be a comment on the question. Especially since it's not clear why the OP is using that content type in the first place.
– Jared Smith
Mar 26 at 14:33
@sne4ky, put content-type in lower case doesnt slove the pb. and whitout content-type headers. Il's the same.
– Henkq
Mar 26 at 21:44
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55359490%2fdifference-between-curl-and-python-requests%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"
1
This is correct and valuable, but doesn't actually answer the question. It should be a comment on the question. Especially since it's not clear why the OP is using that content type in the first place.
– Jared Smith
Mar 26 at 14:33
@sne4ky, put content-type in lower case doesnt slove the pb. and whitout content-type headers. Il's the same.
– Henkq
Mar 26 at 21:44
add a comment |
As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"
1
This is correct and valuable, but doesn't actually answer the question. It should be a comment on the question. Especially since it's not clear why the OP is using that content type in the first place.
– Jared Smith
Mar 26 at 14:33
@sne4ky, put content-type in lower case doesnt slove the pb. and whitout content-type headers. Il's the same.
– Henkq
Mar 26 at 21:44
add a comment |
As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"
As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"
answered Mar 26 at 14:30
sne4kysne4ky
213 bronze badges
213 bronze badges
1
This is correct and valuable, but doesn't actually answer the question. It should be a comment on the question. Especially since it's not clear why the OP is using that content type in the first place.
– Jared Smith
Mar 26 at 14:33
@sne4ky, put content-type in lower case doesnt slove the pb. and whitout content-type headers. Il's the same.
– Henkq
Mar 26 at 21:44
add a comment |
1
This is correct and valuable, but doesn't actually answer the question. It should be a comment on the question. Especially since it's not clear why the OP is using that content type in the first place.
– Jared Smith
Mar 26 at 14:33
@sne4ky, put content-type in lower case doesnt slove the pb. and whitout content-type headers. Il's the same.
– Henkq
Mar 26 at 21:44
1
1
This is correct and valuable, but doesn't actually answer the question. It should be a comment on the question. Especially since it's not clear why the OP is using that content type in the first place.
– Jared Smith
Mar 26 at 14:33
This is correct and valuable, but doesn't actually answer the question. It should be a comment on the question. Especially since it's not clear why the OP is using that content type in the first place.
– Jared Smith
Mar 26 at 14:33
@sne4ky, put content-type in lower case doesnt slove the pb. and whitout content-type headers. Il's the same.
– Henkq
Mar 26 at 21:44
@sne4ky, put content-type in lower case doesnt slove the pb. and whitout content-type headers. Il's the same.
– Henkq
Mar 26 at 21:44
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55359490%2fdifference-between-curl-and-python-requests%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Does the API docs says what kind of content-type it accepts?
– Stargazer
Mar 26 at 14:26
3
Why are you sending an
application/json
content type?– moritzg
Mar 26 at 14:28
With @moritzg. Especially since you aren't POSTing any data.
– Jared Smith
Mar 26 at 14:32
Henkq: uses two different content types for requests. Server: performs differently. Henkq: Pikachu face.
– Giacomo Alzetta
Mar 26 at 14:33
@Stargazer : API docs said mime-type accept application/json and text/plain
– Henkq
Mar 26 at 21:30