Python Forum
Login through a protected directory
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Login through a protected directory
#1
Hi,

I've an index.html page stored in a protected folder, how do I get to it?

The code below doesn't work.
TIA

import requests

url='https://mypage.com/private/index.html'

values={'username':'user','password':'pass'}
r=requests.post(url, data=values)
print(r.content)
Reply
#2
try:
url = 'file:///private/index.html'
the part after file/// needs to be full path
Reply
#3
Thank you, will try. However, it’s a web folder and it may use .haccess as a security gate.
Reply
#4
Solved. Here's the code:

import requests
import urllib3

urllib3.disable_warnings()

URL = 'https://www.mypage.com/private/'
HTACCESS_USER = 'me'
HTACCESS_PASSW = 'mypass'

data = requests.get(URL, verify = False, auth = (HTACCESS_USER, HTACCESS_PASSW))
print(data.text)  # passed .htaccess, perfect! now on login page
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading a copy-protected PDF CaptainCsaba 6 6,073 Oct-25-2021, 07:06 AM
Last Post: Caslenty
  in a login interface when i try login with a user supposed to say test123 but nothing NullAdmin 3 2,218 Feb-20-2021, 04:43 AM
Last Post: bowlofred
  Password protected xls data transfer to master OTH 1 3,157 Feb-15-2021, 08:28 PM
Last Post: OTH
  Reading data from password protected excel Anirudh_Avantsa 2 22,214 Apr-04-2018, 03:26 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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