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;








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










share|improve this question
























  • 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

















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










share|improve this question
























  • 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













0












0








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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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

















  • 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
















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












1 Answer
1






active

oldest

votes


















2














As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"






share|improve this answer


















  • 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










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
);



);













draft saved

draft discarded


















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









2














As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"






share|improve this answer


















  • 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















2














As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"






share|improve this answer


















  • 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













2












2








2







As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"






share|improve this answer













As far as I know, and according to the RFC 2045, the content type should be lowercase. In your case, "'Content-type': 'application/json'"







share|improve this answer












share|improve this answer



share|improve this answer










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












  • 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








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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현