Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/censusgeocode-0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunagm authored Dec 6, 2024
2 parents c8bc641 + 40dc819 commit 1debebd
Show file tree
Hide file tree
Showing 30 changed files with 2,005 additions and 77 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: 'Dependency Review'
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
26 changes: 17 additions & 9 deletions .github/workflows/python-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
limited-dependencies: ["", "TRUE"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
Expand All @@ -32,6 +32,10 @@ jobs:
- name: Install uv
uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12

- name: Patch install error when using Python 3.9, limited dependencies, and MacOS
if: ${{ matrix.limited-dependencies }} == True and ${{ matrix.os }} == "macos-latest" and ${{ matrix.python-version }} == "3.9"
run: uv pip install --system psycopg2-binary==2.9.9

- name: Install dependencies
env:
PARSONS_LIMITED_DEPENDENCIES: ${{ matrix.limited-dependencies }}
Expand All @@ -47,7 +51,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.12
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
Expand All @@ -69,7 +73,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.12
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
Expand All @@ -91,7 +95,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.12
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
Expand All @@ -113,7 +117,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.12
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
Expand All @@ -140,26 +144,30 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
limited-dependencies: ["", "TRUE"]

runs-on: ${{ matrix.os }}

steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Patch install error when using Python 3.9, limited dependencies, and MacOS
if: ${{ matrix.limited-dependencies }} == True and ${{ matrix.os }} == "macos-latest" and ${{ matrix.python-version }} == "3.9"
run: pip install psycopg2-binary==2.9.9

- name: Install dependencies
env:
PARSONS_LIMITED_DEPENDENCIES: ${{ matrix.limited-dependencies }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/security_scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ jobs:

steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- name: "Checkout code"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: results.sarif
results_format: sarif
Expand Down Expand Up @@ -74,6 +74,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 python:3.8
FROM --platform=linux/amd64 python:3.11

####################
## Selenium setup ##
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This project is maintained by [The Movement Cooperative](https://movementcoopera
after [Lucy Parsons](https://en.wikipedia.org/wiki/Lucy_Parsons). The Movement Cooperative is a member-led organization
focused on providing data, tools, and strategic support for the progressive community.

Parsons is only supported for Python 3.8-12.
Parsons is only supported for Python 3.9-12.

## Table of Contents

Expand Down
63 changes: 63 additions & 0 deletions docs/airmeet.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Airmeet
=======

********
Overview
********

`Airmeet <https://www.airmeet.com/>`_ is a webinar platform. This connector supports
fetching events ("Airmeets"), sessions, participants, and other event data via the
`Airmeet Public API for Event Details <https://help.airmeet.com/support/solutions/articles/82000909768-1-event-details-airmeet-public-api>`_.

.. note::
Authentication
You must create an Access Key and Secret Key via the Airmeet website. These are used by the ``Airmeet`` class to fetch
an access token which is used for subsequent interactions with the API. There are three region-based API endpoints; see
the `Airmeet API documentation <https://help.airmeet.com/support/solutions/articles/82000909768-1-event-details-airmeet-public-api#3.-Authentication%C2%A0>`_ for details.

***********
Quick Start
***********

To instantiate the ``Airmeet`` class, you can either store your API endpoint, access key, and secret key as environmental
variables (``AIRMEET_URI``, ``AIRMEET_ACCESS_KEY``, ``AIRMEET_SECRET_KEY``) or pass them in as arguments.

.. code-block:: python
from parsons import Airmeet
# First approach: Use API credentials via environmental variables
airmeet = Airmeet()
# Second approach: Pass API credentials as arguments (airmeet_uri is optional)
airmeet = Airmeet(
airmeet_uri='https://api-gateway.airmeet.com/prod',
airmeet_access_key="my_access_key",
airmeet_secret_key="my_secret_key
)
You can then call various endpoints:

.. code-block:: python
# Fetch the list of Airmeets.
events_tbl = airmeet.list_airmeets()
# Fetch the list of sessions in an Airmeet.
sessions_tbl = airmeet.fetch_airmeet_sessions("my_airmeet_id")
# Fetch the list of registrations for an Airmeet, sorted in order
# of registration date.
participants_tbl = airmeet.fetch_airmeet_participants(
"my_airmeet_id", sorting_direction="ASC"
)
# Fetch the list of session attendees.
session_attendees_tbl = airmeet.fetch_session_attendance("my_session_id")
***
API
***

.. autoclass :: parsons.Airmeet
:inherited-members:
49 changes: 49 additions & 0 deletions docs/empower.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Empower
=======

********
Overview
********

The Empower class allows you to interact with the Empower API. Documentation for the Empower API can be found
in their `GitHub <https://github.com/getempower/api-documentation/blob/master/README.md>`_ repo.

The Empower API only has a single endpoint to access all account data. As such, it has a very high overhead. This
connector employs caching in order to allow the user to specify the tables to extract without additional API calls.
You can disable caching as an argument when instantiating the class.

.. note::
To authenticate, request a secret token from Empower.

==========
Quickstart
==========

To instantiate the Empower class, you can either store your ``EMPOWER_API_KEY`` as an environment
variables or pass it in as an argument:

.. code-block:: python
from parsons import Empower
# First approach: Use API key environment variables
# In bash, set your environment variables like so:
# export EMPOWER_API_KEY='MY_API_KEY'
empower = Empower()
# Second approach: Pass API keys as arguments
empower = Empower(api_key='MY_API_KEY')
You can then request tables in the following manner:

.. code-block:: python
tbl = empower.get_profiles()
***
API
***

.. autoclass :: parsons.Empower
:inherited-members:
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Indices and tables
action_kit
action_builder
action_network
airmeet
airtable
alchemer
auth0
Expand All @@ -199,6 +200,7 @@ Indices and tables
crowdtangle
databases
donorbox
empower
facebook_ads
formstack
freshdesk
Expand Down
12 changes: 12 additions & 0 deletions docs/ngpvan.rst
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,24 @@ Codes
.. autoclass:: parsons.ngpvan.van.Codes
:inherited-members:
=====
Contact Notes
=====
.. autoclass:: parsons.ngpvan.van.ContactNotes
:inherited-members:
=============
Custom Fields
=============
.. autoclass:: parsons.ngpvan.van.CustomFields
:inherited-members:
======
Email
======
.. autoclass:: parsons.ngpvan.van.Email
:inherited-members:
======
Events
======
Expand Down
2 changes: 2 additions & 0 deletions parsons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
("parsons.action_kit.action_kit", "ActionKit"),
("parsons.action_builder.action_builder", "ActionBuilder"),
("parsons.action_network.action_network", "ActionNetwork"),
("parsons.airmeet.airmeet", "Airmeet"),
("parsons.airtable.airtable", "Airtable"),
("parsons.alchemer.alchemer", "Alchemer"),
("parsons.alchemer.alchemer", "SurveyGizmo"),
Expand Down Expand Up @@ -91,6 +92,7 @@
("parsons.turbovote.turbovote", "TurboVote"),
("parsons.twilio.twilio", "Twilio"),
("parsons.zoom.zoom", "Zoom"),
("parsons.empower.empower", "Empower"),
):
try:
globals()[connector_name] = getattr(importlib.import_module(module_path), connector_name)
Expand Down
20 changes: 20 additions & 0 deletions parsons/action_builder/action_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,26 @@ def update_entity_record(self, identifier, data, campaign=None):

return self._upsert_entity(data=data, campaign=campaign)

def remove_entity_record_from_campaign(self, identifier, campaign=None):
"""
Remove an entity record from a campaign. Records cannot be permanently deleted, but a
record that has been removed from a campaign will not appear in the UI.
`Args:`
identifier: str
The unique identifier for the record being removed. ID strings will need to begin
with the origin system, followed by a colon, e.g. `action_builder:abc123-...`.
campaign: str
Optional. The 36-character "interact ID" of the campaign whose data is to be
retrieved or edited. Not necessary if supplied when instantiating the class.
`Returns:`
Dict with HTTP response.
"""

campaign = self._campaign_check(campaign)

url = f"campaigns/{campaign}/people/{identifier}"
return self.api.delete_request(url=url)

def add_section_field_values_to_record(self, identifier, section, field_values, campaign=None):
"""
Add one or more tags (i.e. custom field value) to an existing entity record in Action
Expand Down
3 changes: 3 additions & 0 deletions parsons/airmeet/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from parsons.airmeet.airmeet import Airmeet

__all__ = ["Airmeet"]
Loading

0 comments on commit 1debebd

Please sign in to comment.