-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:ciaranmccormick/hootsweet into d…
…evelop
- Loading branch information
Showing
10 changed files
with
406 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
========== | ||
Hootsweet | ||
========== | ||
|
||
.. image:: https://github.com/ciaranmccormick/hootsweet/workflows/HootSweet/badge.svg :alt: HootSweet | ||
.. image:: https://img.shields.io/pypi/v/hootsweet :alt: PyPI | ||
.. image:: https://img.shields.io/pypi/pyversions/hootsweet :alt: PyPI - Python Version | ||
.. image:: https://img.shields.io/pypi/format/hootsweet :alt: PyPI - Format | ||
.. image:: https://requires.io/github/ciaranmccormick/hootsweet/requirements.svg?branch=feature%2Freadme-rst-format-change | ||
:target: https://requires.io/github/ciaranmccormick/hootsweet/requirements/?branch=feature%2Freadme-rst-format-change | ||
:alt: Requirements Status | ||
|
||
A python API for the HootSuite REST API. | ||
|
||
------------ | ||
Installation | ||
------------ | ||
|
||
.. code-block:: shell | ||
pip install hootsweet | ||
----- | ||
Usage | ||
----- | ||
|
||
.. code-block:: python | ||
from hootsweet import HootSweet | ||
client_id = "Your-HootSuite-Client-ID" | ||
client_secret = "Your-HootSuite-Client-Secret" | ||
redirect_uri = "http://redirect.uri/" | ||
def handle_refresh(token): | ||
# callback function to save token to a database or file | ||
save_token_to_db(token) | ||
client = HootSweet(client_id, client_secret, redirect_uri=redirect_uri, refresh_cb=handle_refresh) | ||
# Step 1 get authorization url from HootSuite | ||
url, state = client.authorization_url() | ||
# Step 2 go to url above and get OAuth2 code | ||
token = client.fetch_token(code) | ||
# client.token now contains your authentication token | ||
# Step 3 (optional) refresh token periodically, this automatically calls handle_refresh | ||
token = client.refresh_token() | ||
# retrieve data from https://platform.hootsuite.com/v1/me | ||
me = client.get_me() | ||
# retrieve authenticated members organizations https://platform.hootsuite.com/v1/me/organizations | ||
organizations = client.get_me_organizations() | ||
Messages | ||
========= | ||
|
||
.. code-block:: python | ||
token = { | ||
"access_token": "e9a90a81-xf2d-dgh3-cfsd-23jhvn76", | ||
"token_Type": "Bearer", | ||
"expires_in": 2592000, | ||
"refresh_token": "82d82cf4-76gf-gfds-nt3k-lzpo12jg", | ||
"scope": "offline" | ||
} | ||
client = HootSweet("client_id", "client_secret", token=token) | ||
# Schedule a message | ||
text = "A message" | ||
social_profile_ids = ["1234", "12345"] | ||
send_time = datetime(2020, 1, 1, 12, 40, 15) | ||
message = client.schedule_message(text=text, social_profile_ids=social_profile_ids, send_time=send_time) | ||
# Get message | ||
message = client.get_message(message_id="98765") | ||
# Delete message | ||
client.delete_message(message_id="98765") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SPHINXAPI ?= sphinx-apidoc | ||
SOURCEDIR = . | ||
MODULEDIR = ../hootsweet | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
api: Makefile | ||
@$(SPHINXAPI) -f -o "$(SOURCEDIR)" "$(MODULEDIR)" | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath("..")) | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "Hootsweet" | ||
copyright = "2020, Ciaran McCormick" | ||
author = "Ciaran McCormick" | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = "0.6.5" | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.napoleon", | ||
"sphinx.ext.coverage", | ||
"sphinx_rtd_theme", | ||
] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ["_templates"] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
# autodoc configuration | ||
autodoc_member_order = "bysource" | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "sphinx_rtd_theme" | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ["_static"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Hootsweet | ||
===================================== | ||
|
||
.. image:: https://github.com/ciaranmccormick/hootsweet/workflows/HootSweet/badge.svg :alt: HootSweet | ||
.. image:: https://img.shields.io/pypi/v/hootsweet :alt: PyPI | ||
.. image:: https://img.shields.io/pypi/pyversions/hootsweet :alt: PyPI - Python Version | ||
.. image:: https://img.shields.io/pypi/format/hootsweet :alt: PyPI - Format | ||
.. image:: https://requires.io/github/ciaranmccormick/hootsweet/requirements.svg?branch=feature%2Freadme-rst-format-change | ||
:target: https://requires.io/github/ciaranmccormick/hootsweet/requirements/?branch=feature%2Freadme-rst-format-change | ||
:alt: Requirements Status | ||
|
||
.. automodule:: hootsweet.api | ||
:members: | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.http://sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
Oops, something went wrong.