Python Forum
Need help in adding xsrf token
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help in adding xsrf token
#1
Hi All,

Below is my requirement and below is my code.

When we post the request to some API via API calls a cookie session will be created on each API call and all the sessions ID, tokens are unique each time. XSRF token is to establish the session with the particular URL for further working sessions with it. The requirement is we just need only to extract the XSRF token from the output

import requests

import json

import os

HOST = 'https://console.cloudendure.com/api/v5/login'

#api_token = '4bbe1c1c-4c67-4603-886b-9d842ccef12a'

headers = {

'userApitoken' : '4bbe1c1c-4c67-4603-886b-9d842ccef12a'

    }

endpoint = '/api/v5/'

session = requests.Session()

session.headers.update({'Content-type': 'application/json', 'Accept': 'text/plain'})

resp = session.post(url=HOST, data=json.dumps({'username': '[email protected]', 'password': 'Password123'}))

response = resp.cookies

print(response)
Reply
#2
Can someone please help me on this
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Refresh token for Wyze SDK duckredbeard 0 1,105 May-16-2022, 04:33 AM
Last Post: duckredbeard
  Need to sign JWT token with JWK key stucoder 1 1,684 Feb-21-2022, 09:04 AM
Last Post: stucoder
  Python requests oauth2 access token herobpv 6 3,895 Sep-27-2021, 06:54 PM
Last Post: herobpv
  unexpected token < in json at position 0 Frodoxzibit 5 2,792 Jul-10-2021, 09:33 AM
Last Post: Larz60+
  / token in function parameterlist tpourjalali 1 1,869 Apr-12-2020, 07:05 PM
Last Post: deanhystad
  Getting an "Unexpected Token" Error and don't know why... NotAHackusator 1 1,839 Nov-20-2019, 03:00 PM
Last Post: buran
  Adding markers to Folium map only adding last element. tantony 0 2,121 Oct-16-2019, 03:28 PM
Last Post: tantony
  get and reuse the token value with huawei modem Reims 1 4,568 Oct-02-2019, 04:29 AM
Last Post: Reims
  Python - joining xmls together invalid token error jan86 0 2,212 Apr-26-2019, 08:52 AM
Last Post: jan86
  syntax error near unexpected token btom529 5 7,674 Apr-21-2019, 09:03 PM
Last Post: btom529

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020