Skip to content

Commit

Permalink
Merge branch 'main' into ianferguson/gcs-pathing
Browse files Browse the repository at this point in the history
Merging main branch
  • Loading branch information
IanRFerguson committed Nov 30, 2023
2 parents f0eb3d6 + 8bdc3a6 commit 5b1ef6e
Show file tree
Hide file tree
Showing 34 changed files with 7,286 additions and 133 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ celerybeat-schedule

# Environments
.env
.venv
.venv*
env/
venv/
venv*/
ENV/
env.bak/
venv.bak/
Expand Down
53 changes: 53 additions & 0 deletions docs/catalist.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Catalist
=======

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

The CatalistMatch class allows you to interact with the Catalist M Tool (match) API. Users of this Parsons integration can use the Parsons table format to send input files to the M Tool and receive back a matched version of that table.

.. note::
Authentication
In order to use this class you must be provided with an OAuth Client ID and Client Secret from catalist, as well as SFTP credentials. You will also need to have Catalist whitelist the IP address you are using to access the M Tool.

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

To instantiate the CatalistMatch class, you must provide your ``client_id``, ``client_secret``, ``sftp_username`` and ``sftp_password`` values as arguments:

.. code-block:: sh
# In bash, set your environment variables like so:
$ export CATALIST_CLIENT_ID='MY_UUID'
$ export CATALIST_CLIENT_SECRET='MY_SECRET'
$ export CATALIST_SFTP_USERNAME='MY_USERNAME'
$ export CATALIST_SFTP_PASSWORD='MY_PASSWORD'
.. code-block:: python
import os
from parsons import CatalistMatch
match = CatalistMatch(
client_id=os.environ['CATALIST_CLIENT_ID'],
client_secret=os.environ['CATALIST_CLIENT_SECRET'],
sftp_username=os.environ['CATALIST_SFTP_USERNAME'],
sftp_password=os.environ['CATALIST_SFTP_PASSWORD']
)
You can then load a CSV as a Parsons table and submit it for matching, then save the resulting matched Parsons table as a CSV.

.. code-block:: python
source_table = Table.from_csv(source_filepath)
result_table = match.match(source_table)
result_table.to_csv(result_filepath)
***
API
***

.. autoclass :: parsons.CatalistMatch
:inherited-members:
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ Indices and tables
google
hustle
mailchimp
mobilecommons
mobilize_america
nation_builder
newmode
Expand Down
49 changes: 49 additions & 0 deletions docs/mobilecommons.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
MobileCommons
==========

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

`MobileCommons <https://secure.mcommons.com/>`_ is a broadcast text messaging tool that helps orgranizations
mobilize supporters and fundraise by building opt-ed in audiences. You can read more about the product
`here <https://uplandsoftware.com/mobile-messaging/>`_.

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

To instantiate a class you must pass the username and password of a MobileCommons account as an argument
or store the username and password into environmental variables called ``MOBILECOMMONS_USERNAME`` and
``MOBILECOMMONS_PASSWORD``, respectively. If you MobileCommons account has access to various MobileCommons
companies (i.e. organizations), you'll need to specify which MobileCommons company you'd like to interact
with by specifying the Company ID in the ``company_id`` parameter. To find the Company ID, navigate to the
`Company and Users page <https://secure.mcommons.com/companies/>`_.

.. code-block:: python
from parsons import MobileCommons
# Pass credentials via environmental variables for account has access to only one MobileCommons company
mc = MobileCommons()
# Pass credentials via environmental variables for account has access to multiple MobileCommons companies
mc = MobileCommons(company_id='EXAMPLE78363BOCA483954419EB70986A68888')
# Pass credentials via argument for account has access to only one MobileCommons company
mc = MobileCommons(username='octavia.b@scifi.net', password='badpassword123')
Then you can call various endpoints:

.. code-block:: python
# Return all MobileCommons subscribers in a table
subscribers = get_campaign_subscribers(campaign_id=1234567)
# Create a new profile, return profile_id
new_profile=create_profile(phone=3073991987, first_name='Jane', last_name='Fonda')
***
API
***
.. autoclass :: parsons.MobileCommons
:inherited-members:
2 changes: 2 additions & 0 deletions docs/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ of commonly used methods. The full list can be found in the API section.
- Remove a column
* - :py:meth:`~parsons.etl.etl.ETL.rename_column`
- Rename a column
* - :py:meth:`~parsons.etl.etl.ETL.rename_columns`
- Rename multiple columns
* - :py:meth:`~parsons.etl.etl.ETL.move_column`
- Move a column within a table
* - :py:meth:`~parsons.etl.etl.ETL.cut`
Expand Down
2 changes: 1 addition & 1 deletion docs/zoom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ participants of past meetings via the `Zoom API <https://developers.zoom.us/docs
to authenticate queries to the Zoom API. You must create a server-to-server application in
`Zoom's app marketplace <https://marketplace.zoom.us/develop/create>` to obtain an
``account_id``, ``client_id``, and ``client_secret`` key. You will use this OAuth application to define your scopes,
which gives your ``Zoom`` connector read permission on endpoints of your choosing (`meetings`, `webinars`, etc.)
which gives your ``Zoom`` connector read permission on endpoints of your choosing (`meetings`, `webinars`, `reports`, etc.)

***********
Quick Start
Expand Down
2 changes: 2 additions & 0 deletions parsons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
("parsons.box.box", "Box"),
("parsons.braintree.braintree", "Braintree"),
("parsons.capitol_canary.capitol_canary", "CapitolCanary"),
["parsons.catalist.catalist", "CatalistMatch"],
("parsons.civis.civisclient", "CivisClient"),
("parsons.controlshift.controlshift", "Controlshift"),
("parsons.copper.copper", "Copper"),
Expand All @@ -65,6 +66,7 @@
("parsons.google.google_sheets", "GoogleSheets"),
("parsons.hustle.hustle", "Hustle"),
("parsons.mailchimp.mailchimp", "Mailchimp"),
("parsons.mobilecommons.mobilecommons", "MobileCommons"),
("parsons.mobilize_america.ma", "MobilizeAmerica"),
("parsons.nation_builder.nation_builder", "NationBuilder"),
("parsons.newmode.newmode", "Newmode"),
Expand Down
3 changes: 2 additions & 1 deletion parsons/action_kit/action_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,13 +651,14 @@ def update_mailing(self, mailer_id, **kwargs):
in the `ActionKit API Documentation <https://roboticdogs.actionkit.com/docs/\
manual/api/rest/actionprocessing.html>`_.
`Returns:`
``None``
``HTTP response from the patch request``
"""

resp = self.conn.patch(
self._base_endpoint("mailer", mailer_id), data=json.dumps(kwargs)
)
logger.info(f"{resp.status_code}: {mailer_id}")
return resp

def rebuild_mailer(self, mailing_id):
"""
Expand Down
Loading

0 comments on commit 5b1ef6e

Please sign in to comment.