You can use the Session object
import requests
headers = {'User-Agent': 'Mozilla/5.0'}
payload = {'username':'niceusername','password':'123456'}
session = requests.Session()
session.post('https://admin.example.com/login.php',headers=headers,data=payload)
# the session instance holds the cookie. So use it to get/post later.
# e.g. session.get('https://example.com/profile')
Related Contents:
- How to remove curly bracket from the output in python?
- How to install packages offline?
- How to “log in” to a website using Python’s Requests module?
- How to upload file with python requests?
- What are the differences between the urllib, urllib2, urllib3 and requests module?
- Correct way to try/except using Python requests module?
- Using python Requests with javascript pages
- How to POST JSON data with Python Requests?
- MaxRetryError: HTTPConnectionPool: Max retries exceeded (Caused by ProtocolError(‘Connection aborted.’, error(111, ‘Connection refused’)))
- How do I disable the security certificate check in Python requests
- How do I disable log messages from the Requests library?
- Log all requests from the python-requests module
- How to use cookies in Python Requests
- Python Requests – No connection adapters
- How to make python Requests work via socks proxy
- Python: download a file from an FTP server
- python requests.get() returns improperly decoded text instead of UTF-8?
- Passing csrftoken with python Requests
- Upload Image using POST form data in Python-requests
- Download and save PDF file with Python requests module
- Use python requests to download CSV
- python requests.get always get 404
- How do I get the IP address from a http request using the requests library?
- Python requests.exceptions.SSLError: EOF occurred in violation of protocol
- Putting a `Cookie` in a `CookieJar`
- Error when loading cookies into a Python request session
- Fastest parallel requests in Python
- How can I send an xml body using requests library?
- Difference between data and json parameters in python requests package
- Python Requests package: Handling xml response
- How to get response SSL certificate from requests in python?
- Only download a part of the document using python requests
- zsh: no matches found: requests[security]
- Python requests library how to pass Authorization header with single token
- How to implement retry mechanism into python requests library?
- How to receive json data using HTTP POST request in Django 1.6?
- Python Requests vs PyCurl Performance
- Python Requests getting SSLerror
- Unable to get local issuer certificate when using requests in python
- OpenSSL errors in python requests
- Can Python Requests library be used on Google App Engine?
- Send http request through specific network interface
- How to get around python requests SSL and proxy error?
- Python requests, how to limit received size, transfer rate, and/or total time?
- parse multipart/form-data, received from requests post
- Python module not found even though “Requirement Already satisfied in Pip”
- Change the connection pool size for Python’s “requests” module when in Threading
- multipart data POST using python requests: no multipart boundary was found
- How do I clear cache with Python Requests?
- Unable to get local issuer certificate when using requests