![Login Session avatar](https://images.apifyusercontent.com/3cJnDHSaXCheUvMMk0YqibYkwCanVCcpuj1hHoO09us/rs:fill:92:92/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9QMk0zZFp6cnZpblpBMjQ1NC85ajl2NG85cXJqekxRVGc1ay1pbWdfMzExODQ2LnBuZw.webp)
Login Session
Try for free
No credit card required
View all Actors![Login Session](https://images.apifyusercontent.com/3cJnDHSaXCheUvMMk0YqibYkwCanVCcpuj1hHoO09us/rs:fill:92:92/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9QMk0zZFp6cnZpblpBMjQ1NC85ajl2NG85cXJqekxRVGc1ay1pbWdfMzExODQ2LnBuZw.webp)
![Login Session](https://images.apifyusercontent.com/3cJnDHSaXCheUvMMk0YqibYkwCanVCcpuj1hHoO09us/rs:fill:92:92/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9QMk0zZFp6cnZpblpBMjQ1NC85ajl2NG85cXJqekxRVGc1ay1pbWdfMzExODQ2LnBuZw.webp)
Login Session
pocesar/login-session
Try for free
No credit card required
Get localStorage, sessionStorage and cookies from logins for usage in other actors.
The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more
1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4client = ApifyClient("<YOUR_API_TOKEN>")
5
6# Prepare the Actor input
7run_input = {
8 "userAgent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36",
9 "maxRequestRetries": 0,
10 "sessionConfig": {
11 "storageName": "login-sessions",
12 "maxAgeSecs": 3600,
13 "maxUsageCount": 100,
14 "maxPoolSize": 100,
15 },
16 "steps": [{
17 "username": { "selector": "input#email" },
18 "password": { "selector": "input#pass" },
19 "submit": { "selector": "input[type=\"submit\"]" },
20 "failed": { "selector": "[role=\"alert\"]" },
21 "waitForMillis": 5000,
22 }],
23 "cookieDomains": [],
24 "gotoTimeout": 30,
25 "proxyConfiguration": { "useApifyProxy": True },
26 "extraUrlPatterns": [],
27}
28
29# Run the Actor and wait for it to finish
30run = client.actor("pocesar/login-session").call(run_input=run_input)
31
32# Fetch and print Actor results from the run's dataset (if there are any)
33print("๐พ Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
34for item in client.dataset(run["defaultDatasetId"]).iterate_items():
35 print(item)
36
37# ๐ Want to learn more ๐? Go to โ https://docs.apify.com/api/client/python/docs/quick-start
Developer
Maintained by Community
Actor metrics
- 7 monthly users
- 4 stars
- Created in Feb 2020
- Modified over 3 years ago
Categories