From 716894ad4897326247048b47f11fa1bcbd62f248 Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Fri, 1 Mar 2019 22:44:12 +0100 Subject: [PATCH] Initial commit --- Pipfile | 11 +++++++++++ README.md | 0 run.py | 5 +++++ setup.cfg | 2 ++ setup.py | 12 ++++++++++++ social_scheduler.egg-info/PKG-INFO | 11 +++++++++++ social_scheduler.egg-info/SOURCES.txt | 11 +++++++++++ social_scheduler.egg-info/dependency_links.txt | 1 + social_scheduler.egg-info/top_level.txt | 1 + social_scheduler/__init__.py | 0 social_scheduler/__main__.py | 4 ++++ .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 155 bytes .../__pycache__/__main__.cpython-37.pyc | Bin 0 -> 203 bytes social_scheduler/__pycache__/main.cpython-37.pyc | Bin 0 -> 350 bytes .../__pycache__/scheduler.cpython-37.pyc | Bin 0 -> 448 bytes social_scheduler/main.py | 7 +++++++ social_scheduler/scheduler.py | 7 +++++++ .../workers/__pycache__/instagram.cpython-37.pyc | Bin 0 -> 705 bytes social_scheduler/workers/facebook.py | 12 ++++++++++++ social_scheduler/workers/instagram.py | 10 ++++++++++ 20 files changed, 94 insertions(+) create mode 100644 Pipfile create mode 100644 README.md create mode 100644 run.py create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 social_scheduler.egg-info/PKG-INFO create mode 100644 social_scheduler.egg-info/SOURCES.txt create mode 100644 social_scheduler.egg-info/dependency_links.txt create mode 100644 social_scheduler.egg-info/top_level.txt create mode 100644 social_scheduler/__init__.py create mode 100644 social_scheduler/__main__.py create mode 100644 social_scheduler/__pycache__/__init__.cpython-37.pyc create mode 100644 social_scheduler/__pycache__/__main__.cpython-37.pyc create mode 100644 social_scheduler/__pycache__/main.cpython-37.pyc create mode 100644 social_scheduler/__pycache__/scheduler.cpython-37.pyc create mode 100644 social_scheduler/main.py create mode 100644 social_scheduler/scheduler.py create mode 100644 social_scheduler/workers/__pycache__/instagram.cpython-37.pyc create mode 100644 social_scheduler/workers/facebook.py create mode 100644 social_scheduler/workers/instagram.py 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 0000000000000000000000000000000000000000..9eccf0339c823ea41656fcb96c9d7b4547900ea6 GIT binary patch literal 155 zcmZ?b<>g`kf``*9V?gv{5CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o6v7KO;XkRX;x^ zGgaR?KP6Sapt2+*KTp3nKRGioN4GdRBQ>QoC$$JF5RVXukI&4@EQycTE2zB1VUwE= MQf3D-y%>lY0JSwI3jhEB literal 0 HcmV?d00001 diff --git a/social_scheduler/__pycache__/__main__.cpython-37.pyc b/social_scheduler/__pycache__/__main__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4de5be332d7f81897a43f3c9d0c929000837a772 GIT binary patch literal 203 zcmZ?b<>g`k0)e@eF@8Y$F^B^LOhASM5Eshh z21bSy=3oX*mX|;^44RC$SaK6H^KNm($Ajqjct1_%DAD5lB^l?+9!KmjoEO9owsKFmD5g34PQHo5sAbL<#_8j4wf1P>DjBLJ}e BF#-Sp literal 0 HcmV?d00001 diff --git a/social_scheduler/__pycache__/main.cpython-37.pyc b/social_scheduler/__pycache__/main.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9bd597d986219cbfd1e49fd8455393b37385777e GIT binary patch literal 350 zcmYjMOHRW;4E22aRl_ORWI^Ww2vzOA8+H*AiZUY-HIu2vsno2?F}MI54wNmcUV#;M zpan~Q{>XmMUMI;M$Ufe>rya#lE-of1S&`!{fdwmS@FEiethB0@US*1MZAY(=X*+&| zbaJLiNJX#Rv1-rar%2+VdB&o2_E5W6aF>lEOKiyThM-n&F0FVvzp_6WZ#h_df7<5BwDJy$iWe-}~ zK7py{w1Hl9@6OL>zZYMI;gDc_el+(#Sijt&4~oqNra49sL_k4G-~g_t1uYq8*fZh1 z6YdHBmPCVZz|jcW!<)+3ozioukvh0eQu(OVe8Z$T*o9MJm{Ux1f?!cez>>ZZ zi?!>((pR!XWvt+;AgD%XEs2&9lPij7M1q&PKcCdHzVdP_X)5dGGqZrV^Us{cJ7Z#Dq}fgyeYXt$U}J|Dky o4`3#LMmn$jsONjDoBwdfI-fhRhg=(+mCE@#cQ0%_gb|F`8XuW#W&i*H literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..3822b0eb5b013bf21a5ba636365b23e63048c26d GIT binary patch literal 705 zcmZuv%}(4f5FXpflF~($P!Cnbfol$s7eI)XL&c#838_dHlI6x`*EES!JF9BZ-rzw% zJ@u7x<{>`}l2gdj-&Hh;?DQn)`oqalNx_wHbPiDC78(nZ8Ngy@_zg&5 zgh}vBOp47${hP-wXFhzhp%hp{LMQ1VYJ88Tg9TggYrX)*7I4XK`5j_3fNj`uE&@&M zg>IcpD?f2fF8UOy9-XhWlGE3;O|_`?VD3&IG~|9mc{zP5!o&K8H>*rJ_xQ{NQP zmrhqZv7A~nt8DliP)`Buf@ovmR!i7z=Y6J>Yh0&PN}y@4z{c$A-3yMptF(W}Qu;u4 z6CET7w~Pqi@h6fzP?CH-Yb&qK$<%iqiPJEdx>`@HTq||kIo}NQmSzpF`=s@;dxc)4 zH37SN`w|l+9Oo%tmGL|Jn dzNM literal 0 HcmV?d00001 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)