Skip to content

consert/socials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Socials

A social networks CRUD operations attempt
WIP implementation of basic social networking operations like 'read', 'create', 'search', 'update', 'delete' content.
Started with Facebook, Instagram, Twitter, Mastodon, LinkedIn

Examples:

./main.ipynb

Usage & Requirements

For every network, you will need authentication.
You should first provide the required credentials in a dot env file (cp env.template .env).
A template is available here: ./env.template with contents:

FACEBOOK_ACCESS_TOKEN=

TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=
TWITTER_TOKEN=
TWITTER_TOKEN_SECRET=

INSTAGRAM_LOGIN=
INSTAGRAM_PASSWORD=

# example (comma separated keys):
MASTODON_INSTANCE_KEYS=SCHOLAR_SOCIAL,MASTODON_SOCIAL
# use these keys to define the urls and the secrets
# SCHOLAR_SOCIAL
MASTODON_SCHOLAR_SOCIAL_URL=https://scholar.social
MASTODON_SCHOLAR_SOCIAL_TOKEN=
MASTODON_SCHOLAR_SOCIAL_CLIENT_ID=
MASTODON_SCHOLAR_SOCIAL_CLIENT_SECRET=
# MASTODON_SOCIAL
MASTODON_MASTODON_SOCIAL_URL=https://mastodon.social
MASTODON_MASTODON_SOCIAL_TOKEN=
MASTODON_MASTODON_SOCIAL_CLIENT_ID=
MASTODON_MASTODON_SOCIAL_CLIENT_SECRET=

# LINKEDIN
LINKEDIN_LISTENING_PORT=8000
LINKEDIN_REDIRECT_URI=http://localhost:8000/
LINKEDIN_APP_CLIENT_ID=
LINKEDIN_APP_CLIENT_SECRET=
# if you already have add them below:
# else, an attempt to get them will be made on first run
LINKEDIN_ACCESS_TOKEN=
LINKEDIN_REFRESH_TOKEN=
LINKEDIN_TOKEN_CREATED_AT=1604090956.07258
LINKED_ACCESS_TOKEN_EXPIRES_IN=5183999
LINKED_REFRESH_TOKEN_EXPIRES_IN=31535999

LinkedIn

Make sure your app asks for the r_liteprofile and w_member_social permissions in order to get the user's urn and post on his/her behalf.

img

Make also sure, that your app is able to get both an access, and a refresh token, so we can update expired tokens.

img

Mastodon

The good thing is that you only need to get an access_token only once (it does not expire):

img

Install

pip3 install git+https://github.com/consert/socials.git

or git clone, cd to the root of this repo and run:

python3 setup.py install --user

or build a wheel and install it with pip:

# if not already: `pip3 install wheel`
python3 setup.py bdist_wheel
pip install --user ./dist/*.whl

Libraries - Credits

The implementation either makes use or is inspired by the implementation of:
[Facebook]: https://github.com/mobolic/facebook-sdk
[Mastodon]: https://github.com/halcy/Mastodon.py
[Instagram]: https://pypi.org/project/instabot/
[LinkedIn]: https://pypi.org/project/python-linkedin-v2/
[Twitter]: https://pypi.org/project/requests-oauthlib/
[.env]: https://pypi.org/project/python-dotenv/
requirements.txt

Licence

MIT LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published