commit 716894ad4897326247048b47f11fa1bcbd62f248 Author: Patrick Neff Date: Fri Mar 1 22:44:12 2019 +0100 Initial commit diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..7cddf06 --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] +facebook-sdk = "*" +social-scheduler = {editable = true,path = "."} +instagramapi = "*" diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/run.py b/run.py new file mode 100644 index 0000000..1db056b --- /dev/null +++ b/run.py @@ -0,0 +1,5 @@ +from sys import argv +from social_scheduler.main import main + +if __name__ == '__main__': + main(argv[1:]) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..17e17e9 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[options] +python_requires = >= 3.6 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..a0f21c6 --- /dev/null +++ b/setup.py @@ -0,0 +1,12 @@ +import os +from setuptools import setup + +setup( + name = "social-scheduler", + version = "0.0.1", + author = "Patrick Neff", + author_email = "odie86@gmail.com", + description = ('Posts to social media on a schedule'), + license = "BSD", + packages=['social_scheduler'], +) diff --git a/social_scheduler.egg-info/PKG-INFO b/social_scheduler.egg-info/PKG-INFO new file mode 100644 index 0000000..393b6ba --- /dev/null +++ b/social_scheduler.egg-info/PKG-INFO @@ -0,0 +1,11 @@ +Metadata-Version: 1.2 +Name: social-scheduler +Version: 0.0.1 +Summary: Posts to social media on a schedule +Home-page: UNKNOWN +Author: Patrick Neff +Author-email: odie86@gmail.com +License: BSD +Description: UNKNOWN +Platform: UNKNOWN +Requires-Python: >= 3.6 diff --git a/social_scheduler.egg-info/SOURCES.txt b/social_scheduler.egg-info/SOURCES.txt new file mode 100644 index 0000000..d3e51e7 --- /dev/null +++ b/social_scheduler.egg-info/SOURCES.txt @@ -0,0 +1,11 @@ +README.md +setup.cfg +setup.py +social_scheduler/__init__.py +social_scheduler/__main__.py +social_scheduler/main.py +social_scheduler/scheduler.py +social_scheduler.egg-info/PKG-INFO +social_scheduler.egg-info/SOURCES.txt +social_scheduler.egg-info/dependency_links.txt +social_scheduler.egg-info/top_level.txt \ No newline at end of file diff --git a/social_scheduler.egg-info/dependency_links.txt b/social_scheduler.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/social_scheduler.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/social_scheduler.egg-info/top_level.txt b/social_scheduler.egg-info/top_level.txt new file mode 100644 index 0000000..4efeb2f --- /dev/null +++ b/social_scheduler.egg-info/top_level.txt @@ -0,0 +1 @@ +social_scheduler diff --git a/social_scheduler/__init__.py b/social_scheduler/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/social_scheduler/__main__.py b/social_scheduler/__main__.py new file mode 100644 index 0000000..838f98c --- /dev/null +++ b/social_scheduler/__main__.py @@ -0,0 +1,4 @@ +from .main import main + +if __name__ == '__main__': + main() diff --git a/social_scheduler/__pycache__/__init__.cpython-37.pyc b/social_scheduler/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..9eccf03 Binary files /dev/null and b/social_scheduler/__pycache__/__init__.cpython-37.pyc differ diff --git a/social_scheduler/__pycache__/__main__.cpython-37.pyc b/social_scheduler/__pycache__/__main__.cpython-37.pyc new file mode 100644 index 0000000..4de5be3 Binary files /dev/null and b/social_scheduler/__pycache__/__main__.cpython-37.pyc differ diff --git a/social_scheduler/__pycache__/main.cpython-37.pyc b/social_scheduler/__pycache__/main.cpython-37.pyc new file mode 100644 index 0000000..9bd597d Binary files /dev/null and b/social_scheduler/__pycache__/main.cpython-37.pyc differ diff --git a/social_scheduler/__pycache__/scheduler.cpython-37.pyc b/social_scheduler/__pycache__/scheduler.cpython-37.pyc new file mode 100644 index 0000000..bdaf951 Binary files /dev/null and b/social_scheduler/__pycache__/scheduler.cpython-37.pyc differ diff --git a/social_scheduler/main.py b/social_scheduler/main.py new file mode 100644 index 0000000..a25243f --- /dev/null +++ b/social_scheduler/main.py @@ -0,0 +1,7 @@ +from sys import exit + +from .scheduler import run_scheduler + + +def main(args): + exit(run_scheduler()) diff --git a/social_scheduler/scheduler.py b/social_scheduler/scheduler.py new file mode 100644 index 0000000..26c9446 --- /dev/null +++ b/social_scheduler/scheduler.py @@ -0,0 +1,7 @@ +from .workers.instagram import InstagramWorker +from .workers.facebook import FacebookWorker + + +def run_scheduler(): + #facebook = FacebookWorker('', '') + #instagram = InstagramWorker('', '') diff --git a/social_scheduler/workers/__pycache__/instagram.cpython-37.pyc b/social_scheduler/workers/__pycache__/instagram.cpython-37.pyc new file mode 100644 index 0000000..3822b0e Binary files /dev/null and b/social_scheduler/workers/__pycache__/instagram.cpython-37.pyc differ diff --git a/social_scheduler/workers/facebook.py b/social_scheduler/workers/facebook.py new file mode 100644 index 0000000..2fb118f --- /dev/null +++ b/social_scheduler/workers/facebook.py @@ -0,0 +1,12 @@ +import facebook + + +class FacebookWorker(object): + def __init__(self, page_id, oauth_access_token): + self.page_id = page_id + self.oauth_access_token = oauth_access_token + self.api = facebook.GraphAPI(self.oauth_access_token) + + def post(self, image, caption): + with open(image, 'rb') as photo: + self.api.put_object(self.page_id, 'photos', message=caption, source=photo.read()) diff --git a/social_scheduler/workers/instagram.py b/social_scheduler/workers/instagram.py new file mode 100644 index 0000000..9c2d351 --- /dev/null +++ b/social_scheduler/workers/instagram.py @@ -0,0 +1,10 @@ +from InstagramAPI import InstagramAPI + + +class InstagramWorker(object): + def __init__(self, username, password): + self.api = InstagramAPI(username, password) + self.api.login() + + def post(self, image, caption): + self.api.uploadPhoto(image, caption)