You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## thid-party apps# django-linkedin-posts (our app)importosfromdotenvimportload_dotenv# python-dotenvload_dotenv()
LINKEDIN_AUTHOR_TPYE="organization"# "organization" or "person"LINKEDIN_AUTHOR_ID=os.environ.get("LINKEDIN_AUTHOR_ID")
LINKEDIN_ACCESS_TOKEN=os.environ.get("LINKEDIN_ACCESS_TOKEN")
## The following keys are not needed at the moment## But they are planned to be used.## For example for updating the Access Token using the Refresh Token# LINKEDIN_CLIENT_ID = os.environ.get("LINKEDIN_CLIENT_ID")# LINKEDIN_CLIENT_SECRET = os.environ.get("LINKEDIN_CLIENT_SECRET") # LINKEDIN_REFRESH_TOKEN = os.environ.get("LINKEDIN_REFRESH_TOKEN")
Usage
Create a simple Post
fromdjango_linkedin_posts.modelsimportPost# create a post instance in the dbpost=Post.objects.create(
comment="Hi, this is me publishing a post using django-linkedin-posts"
)
# share it in Linkedin post.share()
Create a poll with options
fromdjango_linkedin_posts.modelsimportcreate_poll_with_options# create a poll with its options. p=create_poll_with_options("hello", "What's up?", ["good", "bad"])
# share itp.share()