Note: I’m not experienced with programming and need help setting up Python automation in Zapier.
I’m trying to create an automated workflow that extracts member information from my organization’s member portal and sends it to a Google Sheet. The data includes details like names, contact info, addresses, and dates.
I found a Python library on GitHub that can access this data:
# Installation command
pip3 install member-portal-api
# Sample usage
from portal import DataAPI as Portal
api_client = Portal("<USERNAME>", "<PASSWORD>", <ORG_ID>)
time_period = 6
new_members = api_client.get_recent_additions(time_period)
for person in new_members:
print("{}: {}".format(person['fullName'], person['homeAddress']))
My current Zapier setup is: Scheduler → HTTP Request → Python Code → Google Sheets
The issue is I keep getting syntax errors and empty data when trying to use this code in Zapier’s Python action. I’ve attempted various ways of splitting the GitHub code between the HTTP request step and Python code step, but nothing works.
The original data source shows information in a table format with columns for name, age, join date, role, contact details, and address. I want all these fields transferred to separate columns in my spreadsheet.
How should I structure the HTTP request action and Python code action in Zapier to make this work properly?
zapier’s python step is super limited - you can’t install external packages, which explains ur errors. I switched to using zapier’s webhook trigger instead of the scheduler + http combo. Either set up the webhook to get data straight from your portal (if it supports webhooks), or run a cloud function with ur actual member-portal-api code and send the results to zapier. much cleaner than trying to reverse-engineer that library.
Had this exact problem when automating data extraction for our company directory. The fix was getting authentication right in the HTTP step first. Since Zapier’s Python environment doesn’t support external libraries, you’ve got to replicate what member-portal-api does manually. Check the library’s GitHub source to find the actual API endpoints it hits. Most member portals use token auth, so set up a POST request to the login endpoint with your credentials to grab an auth token. Then use that token for subsequent requests to pull member data. In your Python step, just focus on parsing and formatting the JSON from the HTTP step. Those syntax errors are probably from Zapier’s restrictive Python environment. Make sure you’re accessing input_data dictionary correctly and returning properly formatted output for Sheets. Test each step separately to pinpoint where it’s breaking.
The problem is Zapier’s Python environment doesn’t allow external pip installs like member-portal-api. You’ll have to do what that library does manually with HTTP requests. Check the GitHub repo to see what API endpoints the library hits. Most portal APIs use REST with authentication headers. Set up your HTTP Request step to authenticate with your credentials and pull member data straight from the portal’s endpoints. In your Python Code step, you’ll get the HTTP response as input. Parse the JSON to grab the member fields you want: import json response_data = json.loads(input_data[‘http_response’]) members = response_data.get(‘members’, ) output = for member in members: formatted_member = { ‘name’: member.get(‘fullName’), ‘age’: member.get(‘age’), ‘join_date’: member.get(‘joinDate’), ‘role’: member.get(‘role’), ‘contact’: member.get(‘contactDetails’), ‘address’: member.get(‘homeAddress’) } output.append(formatted_member) return output. This gets around the library restriction and does the same thing.