Overview

In the past, I wrote articles about registering data using Drupal’s JSON:API with Python.

The following uses Basic authentication.

And the following uses an API Key.

In addition to these methods, I was able to register data using regular login authentication, so this is a memo of that process.

Code

The code is as follows. It logs in, obtains a CSRF token, and then registers content.

iiifcmmmrlpppoaooomsrrrsddddtttdeeeeoAffffrjotpesseil#s###ssl#llig#ciec#urieqonC_oeeeooofesflrreflunvliaDlsllgggtCrselsseindrfeffiiil_Sfceapresiei_u.l..nnnljhoscR_fcs##s}:#st=o#uhcjep:ptmntdpDfUP(__osegesFt"oreeenreossrrspt_oaR.SAsurgoailro{ofrslrl_fsslaoopiio:_tlUJBESereindnffksk_eefafc"ee,dknonnr(ePSaRSllsn=e_._eeittl."""i.o{lei=ntttsnAOsNWfp_{rrstnleoufhCAXscns=freds((evLJNiAO)=ou"seeo_fskr.eoc-este.ssae""ll(_SAcMR:nrn=sskr.=encancCrelrJ==t.ofoUBOPEDfsla{pseeDsnsdteSEfnfeSssasa)vRANI"e,m"oinsRe_creepRx_t.qOeetd:eLS:_=={eCno(pUlrsfrntFct(DuNlla:_rEAEs="osnsoPfer_st"-eosReAfft"dr_PNooe:ne_enA.sft-:TpkeUsP..u,oiUIDsslrt.clsLsp_o=TotelPtIhsstdRP..fesesofe_eotky"kinfAs_ee_reeLOgg.qento)Bsnoe{paeo,L.Eascen=IeeDultak:=Assknepnn=_pNdsosvT=NttRef-tiSiee"p"(dBoDeidprTeeUs.TuerEo.n=:l:fNaAsProeouonnPtUysse_ns_i"otStOsnnes=vvAsSp_qU_trc"ccCnaE(I,_=s).((L.Eec=uRcaesaasSe:_Nc="egf""_pR"oeLotsrptrRUTo).e"UPBoN:dls}upfpifFdR,o2st{SAAsAeotkso_lo_iLk0tesESStM"gssi_ntintc}i1aneRSE(Ea=i.eecsoc/ot/e:tvlNW_,p=ngssoekavk)jsu(fAOUp_esd.etne:s,s".MRR"l2rtietnidno_DDEDLpi0e(o#e_o._ncRR""}ac0sn=xrnaraoUU))/sa:p/=te/pe:pdPPustotsvisieAAs"ino2pn+p{/,LLe:osk0odjoc{__rnee0n.snsdrBB/s/.n:saosraeAAlejc"epneftsSSolso,.i"._apEEgfoot+,tt[o__i.nkejeo'nUUnP"ixsxkdsRR?A}etoteaeLL_Ssn,nt."}fS"_at)/oW,r'ejrOe]xsmRs[toaDp')nt}ota=,nypjspisee/o.'nns]o"t.darete/upaslr_atccioecd(le'e}"{'c,srf_t)o}k"en_response.text}")

With this, content can be registered as follows.

aaa#d}apppapllltliiiaiCCC"}Clll=dliiiaieee{tennna""}nttt"tat..:yt.=lgptcoe{er""}rAgt"itbepi_:bioaincutdtC(s"tly""el)rnee"vf_ifos":aoce_d":lronte:{umnto-"eat(k-{"te)ea:"nnr:t(t"()i"dcpallteaa"i),n"_,t"e,xt"

Summary

There may be some inaccuracies, but I hope you find this helpful.