Login Session
No credit card required
Login Session
No credit card required
Get localStorage, sessionStorage and cookies from logins for usage in other actors.
You can access the Login Session programmatically from your own Python applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.
1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "userAgent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36",
10 "maxRequestRetries": 0,
11 "sessionConfig": {
12 "storageName": "login-sessions",
13 "maxAgeSecs": 3600,
14 "maxUsageCount": 100,
15 "maxPoolSize": 100,
16 },
17 "steps": [{
18 "username": { "selector": "input#email" },
19 "password": { "selector": "input#pass" },
20 "submit": { "selector": "input[type=\"submit\"]" },
21 "failed": { "selector": "[role=\"alert\"]" },
22 "waitForMillis": 5000,
23 }],
24 "cookieDomains": [],
25 "gotoTimeout": 30,
26 "proxyConfiguration": { "useApifyProxy": True },
27 "extraUrlPatterns": [],
28}
29
30# Run the Actor and wait for it to finish
31run = client.actor("pocesar/login-session").call(run_input=run_input)
32
33# Fetch and print Actor results from the run's dataset (if there are any)
34print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
35for item in client.dataset(run["defaultDatasetId"]).iterate_items():
36 print(item)
37
38# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Login Session API in Python
The Apify API client for Python is the official library that allows you to use Login Session API in Python, providing convenience functions and automatic retries on errors.
Install the apify-client
pip install apify-client
Other API clients include:
Actor Metrics
6 monthly users
-
6 stars
20% runs succeeded
Created in Feb 2020
Modified 4 years ago