Bottom Page

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': 'xyz@abc.com', 'password': 'Password123'}))

response = resp.cookies

print(response)

Quote
#2
Can someone please help me on this
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Getting an "Unexpected Token" Error and don't know why... NotAHackusator 1 45 Nov-20-2019, 03:00 PM
Last Post: buran
  Adding markers to Folium map only adding last element. tantony 0 92 Oct-16-2019, 03:28 PM
Last Post: tantony
  get and reuse the token value with huawei modem Reims 1 144 Oct-02-2019, 04:29 AM
Last Post: Reims
  Python - joining xmls together invalid token error jan86 0 371 Apr-26-2019, 08:52 AM
Last Post: jan86
  syntax error near unexpected token btom529 5 995 Apr-21-2019, 09:03 PM
Last Post: btom529
  tweepy:invalid or expired token weareux 2 1,617 Dec-03-2017, 07:27 PM
Last Post: micseydel
  how to treat two token as one token(lexer)? hsunteik 1 1,199 Dec-28-2016, 12:26 AM
Last Post: micseydel

Forum Jump:


Users browsing this thread: 1 Guest(s)