Skip to content

Use Established requests.Session in save_website #116

Answered by rajatomar788
james0048 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @james0048

from pywebcopy.config import get_config
config = get_config(url, project_folder, project_name, bypass_robots, debug, delay, threaded)
webpage = config.create_page()

# here you have the ready webpage instance to do anything
response = webpage.session.get(request_URL)

soup = BeautifulSoup(response.text, 'lxml')

loc = (soup.findAll('input'))[0]['value']

payload['sph_org_location'] = loc

post = webpage.session.post(post_login, data=payload)

# Now you can get the desired page without seeing the login screen
# webpage.get(url)
    
# webpage.save_complete(pop=open_in_browser)

You can use the webpage.session object which is a requests library session that you are using. So …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@james0048
Comment options

@rajatomar788
Comment options

@james0048
Comment options

Answer selected by james0048
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants