Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Need help in adding xsrf token
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 = ''

#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 =, data=json.dumps({'username': '', 'password': 'Password123'}))

response = resp.cookies


Can someone please help me on this

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  / token in function parameterlist tpourjalali 1 154 Apr-12-2020, 07:05 PM
Last Post: deanhystad
  [gpxpy] "Error parsing XML: not well-formed (invalid token): line 1, column 1" Winfried 5 706 Jan-26-2020, 01:09 AM
Last Post: Winfried
  Getting an "Unexpected Token" Error and don't know why... NotAHackusator 1 262 Nov-20-2019, 03:00 PM
Last Post: buran
  Adding markers to Folium map only adding last element. tantony 0 305 Oct-16-2019, 03:28 PM
Last Post: tantony
  get and reuse the token value with huawei modem Reims 1 621 Oct-02-2019, 04:29 AM
Last Post: Reims
  Python - joining xmls together invalid token error jan86 0 673 Apr-26-2019, 08:52 AM
Last Post: jan86
  syntax error near unexpected token btom529 5 2,235 Apr-21-2019, 09:03 PM
Last Post: btom529
  tweepy:invalid or expired token weareux 2 2,351 Dec-03-2017, 07:27 PM
Last Post: micseydel
  how to treat two token as one token(lexer)? hsunteik 1 1,403 Dec-28-2016, 12:26 AM
Last Post: micseydel

Forum Jump:

Users browsing this thread: 1 Guest(s)