Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.lang.python > #3746

Re: Tentative de transcription d'une ligne de commande « Curl » à l'aide de « urllib3 ».

Path csiph.com!news.mixmin.net!aioe.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!agneau.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed1-a.proxad.net!nnrp1-1.free.fr!not-for-mail
From Valrik <nospam@valrik.invalid>
Newsgroups fr.comp.lang.python
Subject Re: Tentative de transcription d'une ligne de commande « Curl » à l'aide de « urllib3 ».
References <87lezbntpp.fsf@s02.forall> <87h79ypbeo.fsf@universite-de-strasbourg.fr.invalid> <87czkmlz0p.fsf@s02.forall> <878rv9n80y.fsf@s02.forall>
Date Sat, 05 Feb 2022 00:28:13 +0100
Message-ID <87k0eafbzm.fsf@s02.forall> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock sha1:H7TRPNOzXc4jABrS6nCiVp29/14=
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding quoted-printable
Lines 36
Organization Guest of ProXad - France
NNTP-Posting-Date 05 Feb 2022 00:28:13 CET
NNTP-Posting-Host 91.172.153.64
X-Trace 1644017293 news-2.free.fr 29475 91.172.153.64:57770
X-Complaints-To abuse@proxad.net
Xref csiph.com fr.comp.lang.python:3746

Show key headers only | View raw


Valrik <nospam@valrik.invalid> writes:

> Bon j'ai fini par trouver !  :-))
>
> Il fallait « échapper » les « \n, ", \t » et autres joyeusetés avec un «
> \ ». Cela donne :
>
> data_binary='{\"query\":\"{\\n  diffusionsOfShowByUrl(url:
> \\"https://www.franceculture.fr/emissions/fictions-theatre-et-cie\\",
> first: 10) {\\n\\t edges {\\n      cursor\\n      node {\\n
> id\\n          title\\n          url\\n          published_date\\n
> podcastEpisode {\\n            url\\n            title\\n          }\\n
> }\\n    }\\n  }\\n}\"}'
>
> puis au cœur de la requête :
>
> r = http.request(
>     'POST', # Ton intuition était la bonne !
>     'https://openapi.radiofrance.fr/v1/graphql?x-token=b0b8d190-44b8-449f-b3fc-62cf10d3c461',
>     body= data_binary, # « body= », trouvé dans la doc. Déjà utilisé, mais mal.
>     headers={…
>
> Ça devrait aller mieux maintenant… jusqu'à la prochaine difficulté.  ;-)
>
>
> Merci encore.

Ya encore plus simple en fait : il suffit de formater la requête en «
raw ». Ex :
data_binary= r'{"query":"{\n  brands {\n    title\n     description\n}\n}\n"}'

Back to fr.comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

Tentative de transcription d'une ligne de commande « Curl » à l'aide de « urllib3 ». Valrik <nospam@valrik.invalid> - 2022-01-20 01:20 +0100
  Re: Tentative de transcription d'une ligne de commande « Curl » à l'aide de « urllib3 ». Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2022-01-20 18:25 +0100
    Re: Tentative de transcription d'une ligne de commande « Curl » à l'aide de « urllib3 ». Valrik <nospam@valrik.invalid> - 2022-01-21 01:21 +0100
      Re: Tentative de transcription d'une ligne de commande « Curl » à l'aide de « urllib3 ». Valrik <nospam@valrik.invalid> - 2022-01-21 03:21 +0100
        Re: Tentative de transcription d'une ligne de commande « Curl » à l'aide de « urllib3 ». Valrik <nospam@valrik.invalid> - 2022-02-05 00:28 +0100

csiph-web