Initial commit

This commit is contained in:
Patrick Neff 2019-03-01 22:44:12 +01:00
commit 716894ad48
20 changed files with 94 additions and 0 deletions

11
Pipfile Normal file
View File

@ -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 = "*"

0
README.md Normal file
View File

5
run.py Normal file
View File

@ -0,0 +1,5 @@
from sys import argv
from social_scheduler.main import main
if __name__ == '__main__':
main(argv[1:])

2
setup.cfg Normal file
View File

@ -0,0 +1,2 @@
[options]
python_requires = >= 3.6

12
setup.py Normal file
View File

@ -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'],
)

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
social_scheduler

View File

View File

@ -0,0 +1,4 @@
from .main import main
if __name__ == '__main__':
main()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

7
social_scheduler/main.py Normal file
View File

@ -0,0 +1,7 @@
from sys import exit
from .scheduler import run_scheduler
def main(args):
exit(run_scheduler())

View File

@ -0,0 +1,7 @@
from .workers.instagram import InstagramWorker
from .workers.facebook import FacebookWorker
def run_scheduler():
#facebook = FacebookWorker('', '')
#instagram = InstagramWorker('', '')

View File

@ -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())

View File

@ -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)