Python Forum
How to get json data by request with header?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get json data by request with header?
#1
Hello, I would like to go to page https://losoviny.iamroot.eu/part_one and write json text from there.
End at first I must login in https://losoviny.iamroot.eu/part_one_login and use
details in header.

But if If I run code I see:

Error:
raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Do you know how to rewrite it?
(Header data are correct)

Thank you

There is my code:

import json
import requests

headers = {
    'username': 'Loskarlos',
    'password':  'JednohoDneOvladnuKSI'
}


response = requests.post('https://losoviny.iamroot.eu/part_one_login', headers=headers)
        
response_get = requests.get('https://losoviny.iamroot.eu/part_one ')
    
response_get = json.loads(response_get.json())
    
print(response_get)
Yoriz write Nov-06-2021, 04:51 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  get request with custom header canem_inferni 1 2,554 Jun-15-2019, 08:02 PM
Last Post: noisefloor
  Issue with json data pythonFresher 5 3,342 Apr-07-2019, 07:26 AM
Last Post: buran
  Load JSON Data Over Several Templates martin28 4 2,969 Jan-03-2019, 07:44 PM
Last Post: taldridge

Forum Jump:

User Panel Messages

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