├── .gitignore ├── CHANGELOG.md ├── README.md ├── ayrshare ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ └── ayrshare.cpython-310.pyc └── ayrshare.py ├── build └── lib │ └── ayrshare │ ├── __init__.py │ └── ayrshare.py ├── commands.txt ├── dist ├── social-post-api-1.2.4.tar.gz └── social_post_api-1.2.4-py3-none-any.whl ├── setup.py ├── social_post_api.egg-info ├── PKG-INFO ├── SOURCES.txt ├── dependency_links.txt ├── requires.txt └── top_level.txt └── test.py /.gitignore: -------------------------------------------------------------------------------- 1 | ./dist 2 | API-KEY.json 3 | ./build 4 | ./social_post_api.egg-info 5 | ./social_media_api.egg-info 6 | *bfg-report* 7 | __pycache__/* 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.2.4] 2024-12-13 4 | 5 | - Updated `setProfileKey` method to set the profile key for the SocialPost object. 6 | 7 | ## [1.2.3] 2024-12-13 8 | 9 | - Updated README with new docs. 10 | 11 | ## [1.2.1] 2024-09-20 12 | 13 | - Added new endpoints with examples including resize, verify, generate, webhooks, and more. Please see README for details. 14 | - Added new test cases. 15 | - Switch endpoint calls from app.ayrshare.com to api.ayrshare.com. 16 | - Updated packages. 17 | 18 | ## [1.1.1] 2022-11-17 19 | 20 | - Updated code examples and docs. 21 | 22 | No breaking changes. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Social Media APIs for Posting, Scheduling, and Analytics 2 | 3 | ![Ayrshare logo](https://www.ayrshare.com/wp-content/uploads/2020/08/ayr-logo-2156-reduced.png) 4 | 5 | The Social Media API is a Python wrapper SDK for [Ayrshare's APIs](https://www.ayrshare.com). While most of the capabliites are supported, the Python wrapper SDK is not as feature complete as the [Ayrshare's APIs](https://www.ayrshare.com/docs/introduction). 6 | The Social Media API is a Python wrapper SDK for [Ayrshare's APIs](https://www.ayrshare.com). While most of the capabliites are supported, the Python wrapper SDK is not as feature complete as the [Ayrshare's APIs](https://www.ayrshare.com/docs/introduction). 7 | 8 | ## What is Ayrshare? 9 | 10 | Ayrshare is a powerful set of APIs that enable you to send social media posts, get analytics, manage comments, do DMs, and more to *X/Twitter*, *Instagram*, *Facebook*, *LinkedIn*, *YouTube*, *Google Busienss Profile*, *Pinterest*, *TikTok*, *Reddit*, and *Telegram* on behalf of your users or clients. 11 | 12 | The Ayrshare Social API handles all the setup and maintenance for the social media networks. One API to rule them all (yeah, went there). See the full list of [full list of features](https://www.ayrshare.com/docs/apis/overview). 13 | The Ayrshare Social API handles all the setup and maintenance for the social media networks. One API to rule them all (yeah, went there). See the full list of [full list of features](https://www.ayrshare.com/docs/apis/overview). 14 | 15 | Get started with a [free plan](https://www.ayrshare.com/pricing), or if you have a platform or manage multiple users check out the [Business Plan](https://www.ayrshare.com/business-plan-for-multiple-users/). 16 | 17 | For more information on setup, see our installation [video](https://youtu.be/G8M6DZdtcMc) or our [Quick Start Guide](https://www.ayrshare.com/docs/quickstart). 18 | For more information on setup, see our installation [video](https://youtu.be/G8M6DZdtcMc) or our [Quick Start Guide](https://www.ayrshare.com/docs/quickstart). 19 | 20 | ## Installation 21 | 22 | `pip install social-post-api` 23 | 24 | ## Setup 25 | 26 | **1.** Create a free [Ayrshare account](https://app.ayrshare.com). 27 | 28 | ![alt Social Accounts Setup](https://www.ayrshare.com/wp-content/uploads/Ayrshare-login.png) 29 | 30 | **2.** Enable your social media accounts such as C/Twitter, Facebook, LinkedIn, Reddit, Instagram, Google Business Profile, Telegram, TikTok, or YouTube in the Ayrshare dashboard. 31 | 32 | ![alt Social Accounts Setup](https://www.ayrshare.com/wp-content/uploads/Ayrshare-social-linking.png) 33 | 34 | **3.** Copy your API Key from the Ayrshare dashboard. Used for authentication. 35 | 36 | ![alt API Key](https://www.ayrshare.com/wp-content/uploads/Ayrshare-API-key.png) 37 | 38 | ## Getting Started 39 | 40 | ### Initialize Social Media API 41 | 42 | Create a new Social Post object with your API Key. 43 | 44 | ``` python 45 | from ayrshare import SocialPost 46 | social = SocialPost('DJED-DKEP-SJWK-WJKS') # get an API Key at ayrshare.com 47 | ``` 48 | 49 | ### History, Post, Delete Example 50 | 51 | This simple example shows how to post, get history, and delete the post. This example assumes you have a free API key from [Ayrshare](https://www.ayrshare.com) and have enabled X/Twitter, Facebook, and LinkedIn. Note, Instagram, Telegram, YouTube, TikTok, and Reddit also available. 52 | 53 | ``` python 54 | from ayrshare import SocialPost 55 | social = SocialPost('8jKj782Aw8910dCN') # get an API Key at ayrshare.com 56 | 57 | # Post to Platforms Twitter, Facebook, and LinkedIn 58 | postResult = social.post({'post': 'Nice Posting 2', 'platforms': ['twitter', 'facebook', 'linkedin']}) 59 | print(postResult) 60 | 61 | # Delete 62 | deleteResult = social.delete({'id': postResult['id']}) 63 | print(deleteResult) 64 | 65 | # History 66 | print(social.history()) 67 | ``` 68 | 69 | ## Social API 70 | 71 | ### Post 72 | 73 | [Published a new post](https://www.ayrshare.com/docs/apis/post/overview) to the specified social networks either immediately or at scheduled future date with the Social API. Returns a promise that resolves to an object containing the post ID and post status (success, error). See the [post endpoint](https://www.ayrshare.com/docs/apis/post/post) for the full capabilities. 74 | 75 | ``` python 76 | postResponse = social.post({ 77 | # Required 78 | 'post': 'Best post ever!', 79 | 80 | # Required: Social media platforms to post. 81 | # Accepts an array of strings with values: "facebook", "twitter", "linkedin", "pinterest", "reddit", or "telegram". 82 | 'platforms': ['twitter', 'facebook', 'linkedin', 'pinterest', 'telegram', 'instagram'], 83 | 84 | # Optional: URLs of images to include in the post or for Instagram 85 | 'mediaUrls': ['https://img.ayrshare.com/012/gb.jpg'], 86 | 87 | # Optional: Datetime to schedule a future post. 88 | # Accepts an ISO-8601 UTC date time in format "YYYY-MM-DDThh:mm:ssZ". Example: 2021-07-08T12:30:00Z 89 | 'scheduleDate': '2020-08-07T15:17:00Z', 90 | 91 | # Optional: Shorten links in the post for all platforms similar to bit.ly. 92 | # Only URLS starting with http or https will be shortened. Default value: true. 93 | 'shorten_links': true 94 | }) 95 | ``` 96 | 97 | ### Delete 98 | 99 | Delete a post with a given post ID, obtained from the "post" response. Returns a promise with the delete status. Also, can bulk delete multiple IDs at once using the "bulk" key. See the [delete endpoint](https://www.ayrshare.com/docs/apis/post/delete-post) for more details. 100 | Delete a post with a given post ID, obtained from the "post" response. Returns a promise with the delete status. Also, can bulk delete multiple IDs at once using the "bulk" key. See the [delete endpoint](https://www.ayrshare.com/docs/apis/post/delete-post) for more details. 101 | 102 | ``` python 103 | deleteResponse = social.delete({ 104 | # Required 105 | 'id': 'POST ID', # Optional, but required if "bulk" not present 106 | 'bulk': ['Post ID 1', 'Post ID 2', ...] # Optional, but required if "id" not present 107 | }) 108 | ``` 109 | 110 | ### Get Post 111 | 112 | Get a post with a given post ID. Returns a promise that resolves to a post object. See the [get post endpoint](https://www.ayrshare.com/docs/apis/post/get-post) for more details. 113 | Get a post with a given post ID. Returns a promise that resolves to a post object. See the [get post endpoint](https://www.ayrshare.com/docs/apis/post/get-post) for more details. 114 | 115 | ``` python 116 | getResponse = social.getPost({ 117 | # Required 118 | 'id': 'POST ID', 119 | }) 120 | ``` 121 | 122 | ### Retry Post 123 | 124 | Retry a failed post with a given post ID. Returns a promise that resolves to an object with the post status. See the [retry post endpoint](https://www.ayrshare.com/docs/apis/post/retry-post) for more details. 125 | Retry a failed post with a given post ID. Returns a promise that resolves to an object with the post status. See the [retry post endpoint](https://www.ayrshare.com/docs/apis/post/retry-post) for more details. 126 | 127 | ``` python 128 | retryResponse = social.retryPost({ 129 | # Required 130 | 'id': 'POST ID', 131 | }) 132 | ``` 133 | 134 | ### Update Post 135 | 136 | Update a post with a given post ID. Returns a promise that resolves to an object with status and update info. See the [update post endpoint](https://www.ayrshare.com/docs/apis/post/retry-post) for more details. 137 | 138 | ``` python 139 | updateResponse = social.updatePost({ 140 | 'id': 'POST ID', # Required: ID of the post to update 141 | 'scheduleDate': '2024-08-07T15:17:00Z', # Optional: Datetime to schedule a future post. 142 | 'approved': 'true', # Optional: Approve the post to send it. 143 | 'youTubeOptions': { # Optional: YouTube specific options 144 | 'title': 'New Title', 145 | 'description': 'New Description', 146 | 'visibility': 'unlisted', 147 | 'categoryId': 24, 148 | }, 149 | 'notes': 'New notes', # optional: Notes about the post 150 | }) 151 | ``` 152 | 153 | ### History 154 | 155 | Get a [history](https://www.ayrshare.com/docs/apis/history/overview) of all posts and their current status in descending order. Returns a promise that resolves to an array of post objects. See the [history endpoint](https://www.ayrshare.com/docs/apis/history/get-history) for more details. 156 | 157 | ``` python 158 | historyResponse = social.history({ 159 | 'lastRecords': 10, # optional: returns the last X number of history records 160 | 'lastDays': 30, # optional: returns the last X number of days of history records. Defaults to 30 if not present. 161 | }) 162 | ``` 163 | 164 | ### Upload Media 165 | 166 | Upload and store a new image. Returns a URL referencing the image. Can be used in "image_url" in "post". See the [media endpoint](https://www.ayrshare.com/docs/apis/media/overview) for more details. 167 | 168 | ``` python 169 | uploadResponse = social.upload({ 170 | # Required: The image as a Base64 encoded string. Example encoding: https://www.base64-image.de/ 171 | 'file': 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...', 172 | 173 | # Optional 174 | 'fileName': 'test.png', 175 | 176 | # Optional 177 | 'description': 'best image' 178 | }) 179 | ``` 180 | 181 | ### Get Media 182 | 183 | Get all media URLS. Returns a promise that resolves to an array of URL objects. See the [media endpoint](https://www.ayrshare.com/docs/apis/media/get-media-in-gallery) for more details. 184 | Get all media URLS. Returns a promise that resolves to an array of URL objects. See the [media endpoint](https://www.ayrshare.com/docs/apis/media/get-media-in-gallery) for more details. 185 | 186 | ``` python 187 | mediaResponse = social.media() 188 | ``` 189 | 190 | ### Verify Media Exists 191 | 192 | Verify that the media file exists when uploaded. See the [media verify exists endpoint](https://www.ayrshare.com/docs/apis/media/verify-media-url) for more details. 193 | Verify that the media file exists when uploaded. See the [media verify exists endpoint](https://www.ayrshare.com/docs/apis/media/verify-media-url) for more details. 194 | 195 | ``` python 196 | verifyResponse = social.verifyMediaExists({ 197 | # Required: URL of the media file 198 | 'mediaUrl': 'https://img.ayrshare.com/012/gb.jpg', 199 | }) 200 | ``` 201 | 202 | ### Resize Image 203 | 204 | Get image resized according to social network requirements. See the [resize image endpoint](https://www.ayrshare.com/docs/apis/media/resize) for more details. 205 | Get image resized according to social network requirements. See the [resize image endpoint](https://www.ayrshare.com/docs/apis/media/resize) for more details. 206 | 207 | ``` python 208 | resizeResponse = social.resizeImage({ 209 | 'imageUrl': "https://theImage.jpg", # required: URL of the image to resize 210 | 'platform': "facebook" # required: Platform to resize the image for. 211 | 'watermarkUrl': "https:#theWatermark.png", # optional: URL of the watermark image to add to the image. 212 | 'effects': { color: "#A020F0" } # optional: Change opacity, colors, etc. See endpoint for more details. 213 | 'dimensions': { width: 1200, height: 628 } # optional: Width and height of the image. Required if platform is not specified. 214 | 'mode': "blur" # optional. See endpoint for more details. 215 | }) 216 | ``` 217 | 218 | ### User 219 | 220 | Get data about the logged in [user](https://www.ayrshare.com/docs/apis/user/overview), such as post quota, used quota, active social networks, and created date. See the [user endpoint](https://www.ayrshare.com/docs/apis/user/profile-details) for more details. 221 | 222 | ``` python 223 | user = social.user() 224 | ``` 225 | 226 | ### Shorten URL 227 | 228 | Shorten a URL and return the shortened URL. See the [shorten endpoint](https://www.ayrshare.com/docs/apis/links/create-short-link) for more details. 229 | 230 | ``` python 231 | shortenResponse = social.shorten({ 232 | # Required: URL to shorten 233 | 'url': 'https://theURLtoShorten.com/whatmore', 234 | }) 235 | ``` 236 | 237 | ### Analytics 238 | 239 | Get [analytics](https://www.ayrshare.com/docs/apis/analytics/overview) on shortened links and shares, likes, shares, and impressions with for a post or at the accounts level. See the [analytics endpoint](https://www.ayrshare.com/docs/apis/analytics/post) for more details. 240 | 241 | ``` python 242 | analytics = social.analyticsLinks({ 243 | # Optional range 1-7, default 1 day. 244 | 'lastDays': 3 245 | }) 246 | ``` 247 | 248 | ``` python 249 | analytics = social.analyticsPost({ 250 | 'id': 'Post ID', 251 | 'platforms': ['twitter', 'linkedin'] # optional: filter by platform 252 | }) 253 | ``` 254 | 255 | ### Social Analytics 256 | 257 | Get analytics on a social network. Returns a promise that resolves to an object containing the analytics data. See the [social analytics endpoint](https://www.ayrshare.com/docs/apis/analytics/social) for more details. 258 | 259 | ```python 260 | analytics = social.analyticsSocial({ 261 | 'platforms': ['twitter', 'linkedin'] # required 262 | }) 263 | ``` 264 | 265 | ### Add an RSS or Substack Feed 266 | 267 | Add a new RSS or Substack feed to auto post all new articles. Returns a promise that resolved to an object containing the feed ID. See [How to Automate Your Blog or Newsletter](https://www.ayrshare.com/how-to-automatically-post-your-blog-or-newsletter-to-social-media/) for more info. 268 | 269 | ``` python 270 | feedResponse = social.addFeed({ 271 | # Required: URL to shorten 272 | 'url': 'https://theRSSFeed', 273 | 274 | # Optional: Value: "rss" or "substack". 275 | # If not set, defaults to "rss" 276 | 'type': 'RSS', 277 | }) 278 | ``` 279 | 280 | ### Delete an RSS or Substack Feed 281 | 282 | Delete an RSS feed for a given ID. 283 | 284 | ``` python 285 | feedResponse = social.deleteFeed({ 286 | # Required: ID of the feed 287 | 'id': 'Feed ID', 288 | }) 289 | ``` 290 | 291 | ### Get Feeds 292 | 293 | Get all registered RSS feeds. Returns a promise that resolves to an array of feed objects. See the [RSS Feeds](https://www.ayrshare.com/docs/apis/feeds/overview) for more details. 294 | 295 | ``` python 296 | feedsResponse = social.getFeeds() 297 | ``` 298 | 299 | ### Update Feed 300 | 301 | Update an RSS feed for a given ID. Returns a promise that resolves to an object containing the feed ID. See the [update feed endpoint](https://www.ayrshare.com/docs/apis/feeds/update-feed) for more details. 302 | Update an RSS feed for a given ID. Returns a promise that resolves to an object containing the feed ID. See the [update feed endpoint](https://www.ayrshare.com/docs/apis/feeds/update-feed) for more details. 303 | 304 | ``` python 305 | feedResponse = social.updateFeed({ 306 | 'id': 'Feed ID', # required: ID of the feed 307 | 'useFirstImage': 'true', # optional: Use the first image in the article to add to the post. 308 | 'autoHashtag': 'true', # optional: Automatically add hashtags to the post. 309 | }) 310 | ``` 311 | 312 | ### Get Comments 313 | 314 | Get comments for a post. See the [comments endpoint](https://www.ayrshare.com/docs/apis/comments/overview) for more details. 315 | 316 | ``` python 317 | getCommentsResponse = social.getComments({ 318 | # Required: ID of the Post 319 | 'id': 'Post Id', 320 | }) 321 | ``` 322 | 323 | ### Post a Comment 324 | 325 | Add a comment to a post. See the [create comment endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment) for more details. 326 | 327 | ``` python 328 | postCommentResponse = social.postComment({ 329 | # Required: ID of the Post 330 | 'id': 'Post Id', 331 | 'platforms': ['facebook', 'instagram'], 332 | 'comment': 'The best comment ever!', 333 | }) 334 | ``` 335 | 336 | ### Delete Comments 337 | 338 | Delete either a single comment or all comments under a post that were sent via Ayrshare. Available for Facebook, Instagram, LinkedIn, Reddit, TikTok, X/Twitter, and YouTube. See the [delete comments endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment) for more details. 339 | 340 | ``` python 341 | deleteCommentResponse = social.deleteComments({ 342 | 'id': "Pkdo9sjk2", # required: Post top-level ID or social comment ID 343 | 'platforms': ["instagram", "facebook"], # optional: Required only if using the social comment id. 344 | }) 345 | ``` 346 | 347 | ### Reply Comment 348 | 349 | Reply to a comment. Available for Facebook, Instagram, LinkedIn, TikTok, X/Twitter, and YouTube. See the [reply comment endpoint](https://www.ayrshare.com/docs/apis/comments/reply-to-comment) for more details. 350 | Reply to a comment. Available for Facebook, Instagram, LinkedIn, TikTok, X/Twitter, and YouTube. See the [reply comment endpoint](https://www.ayrshare.com/docs/apis/comments/reply-to-comment) for more details. 351 | 352 | ``` python 353 | replyCommentResponse = social.replyComment({ 354 | 'commentId': 'Pkdo9sjk2', # required: The Ayrshare commentId returned from the POST comment endpoint. Be sure to use the top level commentId. 355 | 'platforms': ['instagram', 'facebook'], # required: Array of platforms to post the reply. Values: facebook, instagram, linkedin, tiktok, twitter, youtube 356 | 'comment': 'What a comment' # required: The reply to add to the comment. 357 | }) 358 | ``` 359 | 360 | ## Business Functions for Multiple Users - Business or Enterprise Plan Required 361 | 362 | The [Business Plan](https://www.ayrshare.com/business-plan-for-multiple-users/) allows you to create, manage, and post on behalf of client profiles via the API or Dashboard GUI. You can [integrate](https://www.ayrshare.com/docs/multiple-users/business-plan-overview) Ayrshare into your platform, product, or agency and give your clients social media capabilites. Please [contact us](mailto:contact@ayrshare.com) with any questions. 363 | 364 | A User Profile PROFILE_KEY can be set with the `setProfileKey` method. 365 | 366 | ``` python 367 | social = SocialPost(API_KEY) 368 | social.setProfileKey('PROFILE_KEY') 369 | ``` 370 | 371 | Replace `PROFILE_KEY` with the PROFILE_KEY of the profile you want to use. 372 | 373 | Please see the [Authorization](https://www.ayrshare.com/docs/apis/overview#authorization) docs for more details. 374 | 375 | ### Create Profile 376 | 377 | Create a new account [profile](https://www.ayrshare.com/docs/apis/profiles/overview) under the primary account. See the [create profile endpoint](https://www.ayrshare.com/docs/apis/profiles/create-profile) for more details. 378 | 379 | ``` python 380 | createProfileResponse = social.createProfile({ 381 | # Required: title 382 | 'title': 'New Profile Title', 383 | }) 384 | ``` 385 | 386 | ### Delete Profile 387 | 388 | Delete a profile owned by the primary account. See the [delete profile endpoint](https://www.ayrshare.com/docs/apis/profiles/delete-profile) for more details. 389 | Delete a profile owned by the primary account. See the [delete profile endpoint](https://www.ayrshare.com/docs/apis/profiles/delete-profile) for more details. 390 | 391 | ``` python 392 | deleteProfileResponse = social.deleteProfile({ 393 | # Required: profileKey - the API Key of the profile to delete 394 | 'profileKey': 'JI9s-kJII-9283-OMKM', 395 | }) 396 | ``` 397 | 398 | ### Generate a JWT URL 399 | 400 | Generate a JWT Token and URL used for authorizing a user's access to the Social Account linking page. See the [generate JWT endpoint](https://www.ayrshare.com/docs/apis/profiles/generate-jwt) for more details. 401 | Generate a JWT Token and URL used for authorizing a user's access to the Social Account linking page. See the [generate JWT endpoint](https://www.ayrshare.com/docs/apis/profiles/generate-jwt) for more details. 402 | 403 | ``` python 404 | generateJWTResponse = social.generateJWT({ 405 | 'domain': 'mydomain', 406 | 'privateKey': 'private key data...', 407 | 'profileKey': 'JI9s-kJII-9283-OMKM', 408 | }) 409 | ``` 410 | 411 | ### Update Profile 412 | 413 | Update a profile owned by the primary account. See the [update profile endpoint](https://www.ayrshare.com/docs/apis/profiles/update-profile) for more details. 414 | Update a profile owned by the primary account. See the [update profile endpoint](https://www.ayrshare.com/docs/apis/profiles/update-profile) for more details. 415 | 416 | ``` python 417 | updateProfileResponse = social.updateProfile({ 418 | 'profileKey': 'JI9s-kJII-9283-OMKM', #Required: profileKey - the API Key of the profile to update 419 | 'title': 'This is a great new title' #Optional: the new title of the profile 420 | 'disableSocial': ['facebook', 'linkedin'] #Optional: an array of social networks to disable 421 | 'hideTitle': 'true' #Optional: hide the title of the profile 422 | 'displayTitle': 'true' #Optional: display the title of the profile 423 | }) 424 | ``` 425 | 426 | ### Get Profiles 427 | 428 | Get all the profiles associated with the primary account. See the [get profile endpoint](https://www.ayrshare.com/docs/apis/profiles/get-profiles) for more details. 429 | Get all the profiles associated with the primary account. See the [get profile endpoint](https://www.ayrshare.com/docs/apis/profiles/get-profiles) for more details. 430 | 431 | ``` python 432 | getProfileResponse = social.getProfiles() 433 | ``` 434 | 435 | ### Unlink Social Network 436 | 437 | Unlink a social account for a given user profile owned by the primary account. See the [unlink social network endpoint](https://www.ayrshare.com/docs/apis/profiles/unlink-social-network) for more details. 438 | Unlink a social account for a given user profile owned by the primary account. See the [unlink social network endpoint](https://www.ayrshare.com/docs/apis/profiles/unlink-social-network) for more details. 439 | 440 | ``` python 441 | unlinkResponse = social.unlinkSocial({ 442 | 'profileKey': "JI9s-kJII-9283-OMKM", # Required: profileKey - the API Key of the profile to unlink for. 443 | 'platform': "facebook" 444 | }) 445 | ``` 446 | 447 | ### Get Brand Info on a User 448 | 449 | Get brand information on users and companies public social media accounts. See the [brand endpoint](https://www.ayrshare.com/docs/apis/brand/overview) for more details. 450 | 451 | ``` python 452 | brandResponse = social.getBrandByUser({ 453 | 'platforms': ['instagram', 'facebook'], 454 | 'instagramUser': '@ayrshare', 455 | 'facebookUser': 'ayrshare', 456 | }) 457 | ``` 458 | 459 | ### Auto Hashtags 460 | 461 | Automatically add hashtags to your post. See the [auto hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/overview) for more details. 462 | 463 | ``` python 464 | autoHashtagsResponse = social.autoHashtags({ 465 | 'post': 'I love social media', # required: Post text to add hashtags for. 466 | 'position': 'auto' # optional: Position of the hashtags. Values: 'auto', 'end'. Default: 'auto'. 467 | 'max': 2 # optional: Maximum number of hashtags to add, ranging 1-5. Default: 2. 468 | }) 469 | ``` 470 | 471 | ### Recommend Hashtags 472 | 473 | Get suggestions for hashtags based on a keyword. See the [recommend hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/recommend-hashtags) for more details. 474 | Get suggestions for hashtags based on a keyword. See the [recommend hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/recommend-hashtags) for more details. 475 | 476 | ``` python 477 | recommendHashtagsResponse = social.recommendHashtags({ 478 | 'keyword': 'social media', # required: Keyword to get hashtags for. 479 | }) 480 | ``` 481 | 482 | ### Check Banned Hashtags 483 | 484 | Check if a hashtag is banned on Instagram or other social networks. See the [check banned hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/check-hashtags) for more details. 485 | Check if a hashtag is banned on Instagram or other social networks. See the [check banned hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/check-hashtags) for more details. 486 | 487 | ``` python 488 | checkBannedHashtagsResponse = social.checkBannedHashtags({ 489 | 'hashtag': 'socialmedia', # required: Hashtag to check. 490 | }) 491 | ``` 492 | 493 | ### Get All Reviews 494 | 495 | Retrieve all the reviews for the specified platform. See the [get all reviews endpoint](https://www.ayrshare.com/docs/apis/reviews/get-reviews) for more details. 496 | Retrieve all the reviews for the specified platform. See the [get all reviews endpoint](https://www.ayrshare.com/docs/apis/reviews/get-reviews) for more details. 497 | 498 | ``` python 499 | allReviewsResponse = social.reviews({ 500 | 'platform': 'facebook', # required: Platform to get reviews for. Currently available: "facebook", "gmb" 501 | }) 502 | ``` 503 | 504 | ### Get Single Review 505 | 506 | Retrieve a single review. See the [get single review endpoint](https://www.ayrshare.com/docs/apis/reviews/get-one-review) for more details. 507 | Retrieve a single review. See the [get single review endpoint](https://www.ayrshare.com/docs/apis/reviews/get-one-review) for more details. 508 | 509 | ``` python 510 | singleReviewResponse = social.review({ 511 | 'id': 'Review ID', # required 512 | 'platform': 'gmb', # required: Platform to get review for. Currently available: "gmb" 513 | }) 514 | ``` 515 | 516 | ### Reply to Review 517 | 518 | Reply to a review. See the [reply to review endpoint](https://www.ayrshare.com/docs/apis/reviews/reply-review) for more details. 519 | Reply to a review. See the [reply to review endpoint](https://www.ayrshare.com/docs/apis/reviews/reply-review) for more details. 520 | 521 | ``` python 522 | replyReviewResponse = social.replyReview({ 523 | 'reviewId': 'Review ID', # required: Review ID to reply to. 524 | 'platform': 'facebook', # required: Platform to reply to review for. Currently available: "facebook", "gmb" 525 | 'reply': 'Thank you for the review' # required: Text of the reply to the review. 526 | }) 527 | ``` 528 | 529 | ### Delete Review Reply 530 | 531 | Delete a review reply. See the [delete review reply endpoint](https://www.ayrshare.com/docs/apis/reviews/reply-review) for more details. 532 | 533 | ``` python 534 | deleteReplyReviewResponse = social.deleteReplyReview({ 535 | 'reviewId': 'Review ID', # required: Review ID to delete reply for. 536 | 'platform': 'gmb', # required: Platform to delete reply for. Currently available: "gmb" 537 | }) 538 | ``` 539 | 540 | ## Max Pack Required 541 | 542 | ### Generate Post 543 | 544 | Generate a new social post using ChatGPT. Token limits applicable. See the [generate post endpoint](https://www.ayrshare.com/docs/apis/generate/post-text) for more details. 545 | Generate a new social post using ChatGPT. Token limits applicable. See the [generate post endpoint](https://www.ayrshare.com/docs/apis/generate/post-text) for more details. 546 | 547 | ``` python 548 | generatePostResponse = social.generatePost({ 549 | 'text': 'I love social media', # required: Description of what the post should be about. 550 | 'hashtags': 'true', #optional: Include hashtags in the post. Default: true 551 | 'emojis': 'true', # optional: Include emojis in the post. Default: false 552 | 'twitter': 'true', # optional: Construct a post 280 or few characters. Default: false 553 | }) 554 | ``` 555 | 556 | ### Generate Rewrite 557 | 558 | Generate variations of a social media post using ChatGPT. Token limits applicable. See the [generate rewrite endpoint](https://www.ayrshare.com/docs/apis/generate/rewrite-post) for more details. 559 | Generate variations of a social media post using ChatGPT. Token limits applicable. See the [generate rewrite endpoint](https://www.ayrshare.com/docs/apis/generate/rewrite-post) for more details. 560 | 561 | ``` python 562 | generateRewriteResponse = social.generateRewrite({ 563 | 'post': 'I love social media', # required: The post text to be rewritten. 564 | 'emojis': 'true', # optional: Include emojis in the post. Default: false 565 | 'hashtags': 'true', # optional: Include hashtags in the post. Default: false 566 | 'twitter': 'true', # optional: Construct a post 280 or few characters. Default: false 567 | 'rewrites': 5, # optional: Number of rewrites to generate. Default: 5 568 | }) 569 | ``` 570 | 571 | ### Generate Transcription 572 | 573 | Provide a transcription of a video file. See the [generate transcription endpoint](https://www.ayrshare.com/docs/apis/generate/transcribe-video) for more details. 574 | Provide a transcription of a video file. See the [generate transcription endpoint](https://www.ayrshare.com/docs/apis/generate/transcribe-video) for more details. 575 | 576 | ``` python 577 | generateTranscriptionResponse = social.generateTranscription({ 578 | 'videoUrl': 'https://theVideo.mp4', # required: URL encoded video URL. The video must be hosted by Ayrshare. 579 | }) 580 | ``` 581 | 582 | ### Generate Translation 583 | 584 | Translate text for a post to over 100 different languages. See the [generate translation endpoint](https://www.ayrshare.com/docs/apis/generate/translate-post) for more details. 585 | Translate text for a post to over 100 different languages. See the [generate translation endpoint](https://www.ayrshare.com/docs/apis/generate/translate-post) for more details. 586 | 587 | ``` python 588 | generateTranslationResponse = social.generateTranslation({ 589 | 'text': 'I love social media', # required: The text to be translated. 590 | 'lang': 'es', # required: The language code to translate the text to. 591 | }) 592 | ``` 593 | 594 | ### Generate Sentiment Analysis 595 | 596 | Generate a sentiment analysis on a social media post or comment to understand if the text is positive, negative, or neutral and recommendations on improving the text for a more positive reaction. See the [generate sentiment analysis endpoint](https://www.ayrshare.com/docs/apis/generate/sentiment) for more details. 597 | 598 | ``` python 599 | generateSentiment= social.generateSentiment({ 600 | 'text': 'I love social media' # required: The text to generate a sentiment analysis for. 601 | }) 602 | ``` 603 | 604 | ### Generate Alt Text 605 | 606 | Create AI-generated alt text for your images. See the [generate alt text endpoint](https://www.ayrshare.com/docs/apis/generate/sentiment) for more details. 607 | 608 | ``` python 609 | generateAltTextResponse = social.generateAltText({ 610 | 'url': 'https://theImage.jpg', # required: URL of the image to generate alt text for. 611 | 'keywords': ['social media', 'ayrshare'], # optional: Keywords to help the AI generate better alt text. 612 | 'lang': 'en' # optional: The language code to generate the alt text in. Default: 'en' 613 | }) 614 | ``` 615 | 616 | ### Shorten link 617 | 618 | Provide a URL and a shortened link will be returned. See the [shorten link endpoint](https://www.ayrshare.com/docs/apis/links/overview) for more details. 619 | 620 | ``` python 621 | shortenLinkResponse = social.shortLink({ 622 | 'url': 'https://theURL.com', # required: URL to shorten. 623 | 'utmId': '1234', # optional: UTM ID to track the link. See more details about utm parameters at endpoint link above. 624 | 'utmSource': 'source', # optional 625 | 'utmMedium': 'medium', # optional 626 | 'utmCampaign': 'campaign', # optional 627 | 'utmTerm': 'term', # optional 628 | 'utmContent': 'content', # optional 629 | }) 630 | ``` 631 | 632 | ### Analytics for Shortened Links 633 | 634 | Return analytics for all shortened links or a single link for a given link ID. See the [analytics link endpoint](https://www.ayrshare.com/docs/apis/links/link-analytics) for more details. 635 | Return analytics for all shortened links or a single link for a given link ID. See the [analytics link endpoint](https://www.ayrshare.com/docs/apis/links/link-analytics) for more details. 636 | 637 | ``` python 638 | analyticsLinkResponse = social.shortLinkAnalytics({ 639 | 'id': 'Link ID', # optional: Link ID to get analytics for. 640 | 'fromCreatedDate': '2023-07-08T12:30:00Z', # optional: Get history of links shortened after this date. 641 | 'toCreatedDate': '2023-07-08T12:30:00Z', # optional: Get history of links shortened before this date. 642 | 'fromClickDate': '2023-07-08T12:30:00Z', # optional: Get history of links clicked after this date. 643 | 'toClickDate': '2023-07-08T12:30:00Z', # optional: Get history of links clicked before this date. 644 | }) 645 | ``` 646 | 647 | ### Additional Calls 648 | 649 | - [Webhooks endpoints](https://www.ayrshare.com/docs/apis/webhooks/overview) 650 | - [Webhooks endpoints](https://www.ayrshare.com/docs/apis/webhooks/overview) 651 | - unregisterWebhook 652 | - listWebhook 653 | - setAutoSchedule 654 | - deleteAutoSchedule 655 | - listAutoSchedule 656 | 657 | ## Other Packages & Integrations 658 | 659 | We have other package and integrations such as [Node NPM](https://www.ayrshare.com/docs/packages-guides/nodejs), [Bubble.io](https://www.ayrshare.com/docs/packages-guides/bubble), [Make](https://www.ayrshare.com/docs/packages-guides/make), and [Airtable](https://www.ayrshare.com/docs/packages-guides/airtable). 660 | 661 | ### Information and Support 662 | 663 | Additional examples, responses, etc. can be found at: 664 | 665 | [RESTful API Endpoint Docs](https://www.ayrshare.com/docs/apis/overview) 666 | [RESTful API Endpoint Docs](https://www.ayrshare.com/docs/apis/overview) 667 | 668 | [GitHub](https://github.com/ayrshare/social-post-api-python) 669 | 670 | See our [changelog](https://www.ayrshare.com/docs/whatsnew/latest) for the latest and greatest. 671 | See our [changelog](https://www.ayrshare.com/docs/whatsnew/latest) for the latest and greatest. 672 | 673 | Please [contact us](mailto:support@ayrshare.com) with your questions, or just to give us shout-out 📢! 674 | -------------------------------------------------------------------------------- /ayrshare/__init__.py: -------------------------------------------------------------------------------- 1 | from ayrshare.ayrshare import SocialPost -------------------------------------------------------------------------------- /ayrshare/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayrshare/social-post-api-python/0ec13a7ab1cf180ab3c0562e51e7159e967c08a1/ayrshare/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ayrshare/__pycache__/ayrshare.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayrshare/social-post-api-python/0ec13a7ab1cf180ab3c0562e51e7159e967c08a1/ayrshare/__pycache__/ayrshare.cpython-310.pyc -------------------------------------------------------------------------------- /ayrshare/ayrshare.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from urllib.parse import urlencode 3 | 4 | # base = 'http://localhost:5001/ayrshare-dev/us-central1/api/' 5 | base = 'https://app.ayrshare.com/api/' 6 | 7 | ERROR_MSG = { 8 | "status": 9 | "error", 10 | "message": 11 | "Wrong parameters. Please verify at https://docs.ayrshare.com/rest-api/endpoints", 12 | } 13 | 14 | def doPost(type, data, headerData): 15 | if data is None: 16 | data = {} 17 | 18 | data["source"] = "pypi" 19 | payload = data 20 | headers = headerData 21 | r = requests.post(base + type, json=payload, headers=headers) 22 | return r.json() 23 | 24 | def doPut(type, data, headerData): 25 | if data is None: 26 | data = {} 27 | 28 | data["source"] = "pypi" 29 | payload = data 30 | headers = headerData 31 | r = requests.put(base + type, json=payload, headers=headers) 32 | return r.json() 33 | 34 | # Build the parameters for the request and handle arrays 35 | def buildParams (data) : 36 | params = {} 37 | for key, value in data.items(): 38 | if type(value) is list: 39 | for i in range(len(value)): 40 | params[key + "[" + str(i) + "]"] = value[i] 41 | else: 42 | params[key] = value 43 | return params 44 | 45 | def doGet(type, params, headerData): 46 | if params is None: 47 | params = {} 48 | 49 | params["source"] = "pypi" 50 | headers = headerData 51 | r = requests.get("{}{}?{}".format(base, type, urlencode(buildParams(params))), 52 | headers=headers) 53 | return r.json() 54 | 55 | 56 | def doDelete(type, data, headerData): 57 | if data is None: 58 | data = {} 59 | 60 | data["source"] = "pypi" 61 | payload = data 62 | headers = headerData 63 | r = requests.delete(base + type, json=payload, headers=headers) 64 | return r.json() 65 | 66 | 67 | class SocialPost: 68 | def __init__(self, API_KEY): 69 | self.API_KEY = API_KEY 70 | self.headers = { 71 | 'Content-Type': 'application/json', 72 | 'Authorization': 'Bearer ' + API_KEY 73 | } 74 | 75 | def setProfileKey(self, PROFILE_KEY): 76 | """Set or update the Profile-Key in the headers""" 77 | if PROFILE_KEY: 78 | self.headers['Profile-Key'] = PROFILE_KEY 79 | return self 80 | 81 | def post(self, data, headers=None): 82 | return doPost("post", data, self.headers) 83 | 84 | def delete(self, data=None): 85 | return doDelete("delete", data, self.headers) 86 | 87 | def getPost(self, data=None): 88 | if data is None: 89 | data = {} 90 | 91 | id = "" 92 | 93 | if 'id' in data: 94 | id = '/' + data.get('id') 95 | 96 | return doGet("post" + id, data, self.headers) 97 | 98 | def retryPost(self, data=None): 99 | return doPut("post/retry", data, self.headers) 100 | 101 | def updatePost(self, data=None): 102 | return doPut("post", data, self.headers) 103 | 104 | def history(self, params=None): 105 | if params is None: 106 | params = {} 107 | 108 | id = "" 109 | 110 | if 'id' in params: 111 | id = '/' + params.get('id') 112 | 113 | return doGet("history" + id, params, self.headers) 114 | 115 | def media(self, params=None): 116 | return doGet("media", params, self.headers) 117 | 118 | def verifyMediaExists(self, params=None): 119 | return doPost("media/urlExists", params, self.headers) 120 | 121 | def mediaUploadUrl(self, params=None): 122 | return doGet("media/uploadUrl", params, self.headers) 123 | 124 | def mediaMeta(self, params=None): 125 | return doGet("media/meta", params, self.headers) 126 | 127 | def resizeImage(self, data=None): 128 | return doPost("media/resize", data, self.headers) 129 | 130 | def analyticsPost(self, data=None): 131 | return doPost("analytics/post", data, self.headers) 132 | 133 | def analyticsSocial(self, params=None): 134 | return doPost("analytics/social", params, self.headers) 135 | 136 | def user(self, params=None): 137 | return doGet("user", params, self.headers) 138 | 139 | def upload(self, data=None): 140 | return doPost("upload", data, self.headers) 141 | 142 | def addFeed(self, data=None): 143 | return doPost("feed", data, self.headers) 144 | 145 | def deleteFeed(self, data=None): 146 | return doDelete("feed", data, self.headers) 147 | 148 | def getFeeds(self, params=None): 149 | return doGet("feed", params, self.headers) 150 | 151 | def updateFeed(self, data=None): 152 | return doPut("feed", data, self.headers) 153 | 154 | def createProfile(self, data=None): 155 | return doPost("profiles/create-profile", data, self.headers) 156 | 157 | def deleteProfile(self, data=None): 158 | return doDelete("profiles/delete-profile", data, self.headers) 159 | 160 | def updateProfile(self, data=None): 161 | return doPut("profiles/profile", data, self.headers) 162 | 163 | def getProfiles(self, params=None): 164 | return doGet("profiles", params, self.headers) 165 | 166 | def generateJWT(self, data=None): 167 | return doPost("profiles/generateJWT", data, self.headers) 168 | 169 | def unlinkSocial(self, data=None): 170 | return doDelete("profiles/social", data, self.headers) 171 | 172 | def postComment(self, data=None): 173 | return doPost("comments", data, self.headers) 174 | 175 | def getComments(self, params=None): 176 | if params is None: 177 | params = {} 178 | 179 | id = "" 180 | 181 | if 'id' in params: 182 | id = '/' + params.get('id') 183 | 184 | return doGet("comments" + id, params, self.headers) 185 | 186 | def deleteComments(self, data=None): 187 | if data is None: 188 | data = {} 189 | 190 | id = "" 191 | 192 | if 'id' in data: 193 | id = '/' + data.get('id') 194 | 195 | return doDelete("comments" + id, data, self.headers) 196 | 197 | def replyComment(self, data=None): 198 | return doPost("comments/reply", data, self.headers) 199 | 200 | def setAutoSchedule(self, data=None): 201 | return doPost("auto-schedule/set", data, self.headers) 202 | 203 | def deleteAutoSchedule(self, data=None): 204 | return doDelete("auto-schedule/delete", data, self.headers) 205 | 206 | 207 | def listAutoSchedule(self, params=None): 208 | return doGet("auto-schedule/list", params, self.headers) 209 | 210 | 211 | def registerWebhook(self, data=None): 212 | return doPost("hook/webhook", data, self.headers) 213 | 214 | def unregisterWebhook(self, data=None): 215 | return doDelete("hook/webhook", data, self.headers) 216 | 217 | def listWebhooks(self, params=None): 218 | return doGet("hook/webhook", params, self.headers) 219 | 220 | def getBrandByUser(self, params=None): 221 | return doGet("brand/byUser", params, self.headers) 222 | 223 | def generatePost(self, params=None): 224 | return doPost("generate/post", params, self.headers) 225 | 226 | def generateRewrite(self, params=None): 227 | return doPost("generate/rewrite", params, self.headers) 228 | 229 | def generateTranscription(self, params=None): 230 | return doPost("generate/transcription", params, self.headers) 231 | 232 | def generateTranslation(self, params=None): 233 | return doPost("generate/translate", params, self.headers) 234 | 235 | def generateAltText(self, params=None): 236 | return doPost("generate/altText", params, self.headers) 237 | 238 | def generateSentiment(self, params=None): 239 | return doPost("generate/sentiment", params, self.headers) 240 | 241 | def autoHashtags(self, params=None): 242 | return doPost("hashtags/auto", params, self.headers) 243 | 244 | def recommendHashtags(self, params=None): 245 | return doGet("hashtags/recommend", params, self.headers) 246 | 247 | def checkBannedHashtags(self, params=None): 248 | return doGet("hashtags/banned", params, self.headers) 249 | 250 | def shortLink(self, params=None): 251 | return doPost("links", params, self.headers) 252 | 253 | def shortLinkAnalytics(self, params=None): 254 | if params is None: 255 | params = {} 256 | 257 | id = "" 258 | 259 | if 'id' in params: 260 | id = '/' + params.get('id') 261 | 262 | return doGet("links" + id, params, self.headers) 263 | 264 | def reviews(self, params=None): 265 | return doGet("reviews", params, self.headers) 266 | 267 | def review(self, params=None): 268 | if params is None: 269 | params = {} 270 | 271 | id = "" 272 | 273 | if 'id' in params: 274 | id = '/' + params.get('id') 275 | 276 | return doGet("reviews" + id, params, self.headers) 277 | 278 | def reviewReply(self, params=None): 279 | return doPost("reviews", params, self.headers) 280 | 281 | def deleteReviewReply(self, params=None): 282 | return doDelete("reviews", params, self.headers) 283 | 284 | -------------------------------------------------------------------------------- /build/lib/ayrshare/__init__.py: -------------------------------------------------------------------------------- 1 | from ayrshare.ayrshare import SocialPost -------------------------------------------------------------------------------- /build/lib/ayrshare/ayrshare.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from urllib.parse import urlencode 3 | 4 | # base = 'http://localhost:5001/ayrshare-dev/us-central1/api/' 5 | base = 'https://app.ayrshare.com/api/' 6 | 7 | ERROR_MSG = { 8 | "status": 9 | "error", 10 | "message": 11 | "Wrong parameters. Please verify at https://docs.ayrshare.com/rest-api/endpoints", 12 | } 13 | 14 | def doPost(type, data, headerData): 15 | if data is None: 16 | data = {} 17 | 18 | data["source"] = "pypi" 19 | payload = data 20 | headers = headerData 21 | r = requests.post(base + type, json=payload, headers=headers) 22 | return r.json() 23 | 24 | def doPut(type, data, headerData): 25 | if data is None: 26 | data = {} 27 | 28 | data["source"] = "pypi" 29 | payload = data 30 | headers = headerData 31 | r = requests.put(base + type, json=payload, headers=headers) 32 | return r.json() 33 | 34 | # Build the parameters for the request and handle arrays 35 | def buildParams (data) : 36 | params = {} 37 | for key, value in data.items(): 38 | if type(value) is list: 39 | for i in range(len(value)): 40 | params[key + "[" + str(i) + "]"] = value[i] 41 | else: 42 | params[key] = value 43 | return params 44 | 45 | def doGet(type, params, headerData): 46 | if params is None: 47 | params = {} 48 | 49 | params["source"] = "pypi" 50 | headers = headerData 51 | r = requests.get("{}{}?{}".format(base, type, urlencode(buildParams(params))), 52 | headers=headers) 53 | return r.json() 54 | 55 | 56 | def doDelete(type, data, headerData): 57 | if data is None: 58 | data = {} 59 | 60 | data["source"] = "pypi" 61 | payload = data 62 | headers = headerData 63 | r = requests.delete(base + type, json=payload, headers=headers) 64 | return r.json() 65 | 66 | 67 | class SocialPost: 68 | def __init__(self, API_KEY): 69 | self.API_KEY = API_KEY 70 | self.headers = { 71 | 'Content-Type': 'application/json', 72 | 'Authorization': 'Bearer ' + API_KEY 73 | } 74 | 75 | def setProfileKey(self, PROFILE_KEY): 76 | """Set or update the Profile-Key in the headers""" 77 | if PROFILE_KEY: 78 | self.headers['Profile-Key'] = PROFILE_KEY 79 | return self 80 | 81 | def post(self, data, headers=None): 82 | return doPost("post", data, self.headers) 83 | 84 | def delete(self, data=None): 85 | return doDelete("delete", data, self.headers) 86 | 87 | def getPost(self, data=None): 88 | if data is None: 89 | data = {} 90 | 91 | id = "" 92 | 93 | if 'id' in data: 94 | id = '/' + data.get('id') 95 | 96 | return doGet("post" + id, data, self.headers) 97 | 98 | def retryPost(self, data=None): 99 | return doPut("post/retry", data, self.headers) 100 | 101 | def updatePost(self, data=None): 102 | return doPut("post", data, self.headers) 103 | 104 | def history(self, params=None): 105 | if params is None: 106 | params = {} 107 | 108 | id = "" 109 | 110 | if 'id' in params: 111 | id = '/' + params.get('id') 112 | 113 | return doGet("history" + id, params, self.headers) 114 | 115 | def media(self, params=None): 116 | return doGet("media", params, self.headers) 117 | 118 | def verifyMediaExists(self, params=None): 119 | return doPost("media/urlExists", params, self.headers) 120 | 121 | def mediaUploadUrl(self, params=None): 122 | return doGet("media/uploadUrl", params, self.headers) 123 | 124 | def mediaMeta(self, params=None): 125 | return doGet("media/meta", params, self.headers) 126 | 127 | def resizeImage(self, data=None): 128 | return doPost("media/resize", data, self.headers) 129 | 130 | def analyticsPost(self, data=None): 131 | return doPost("analytics/post", data, self.headers) 132 | 133 | def analyticsSocial(self, params=None): 134 | return doPost("analytics/social", params, self.headers) 135 | 136 | def user(self, params=None): 137 | return doGet("user", params, self.headers) 138 | 139 | def upload(self, data=None): 140 | return doPost("upload", data, self.headers) 141 | 142 | def addFeed(self, data=None): 143 | return doPost("feed", data, self.headers) 144 | 145 | def deleteFeed(self, data=None): 146 | return doDelete("feed", data, self.headers) 147 | 148 | def getFeeds(self, params=None): 149 | return doGet("feed", params, self.headers) 150 | 151 | def updateFeed(self, data=None): 152 | return doPut("feed", data, self.headers) 153 | 154 | def createProfile(self, data=None): 155 | return doPost("profiles/create-profile", data, self.headers) 156 | 157 | def deleteProfile(self, data=None): 158 | return doDelete("profiles/delete-profile", data, self.headers) 159 | 160 | def updateProfile(self, data=None): 161 | return doPut("profiles/profile", data, self.headers) 162 | 163 | def getProfiles(self, params=None): 164 | return doGet("profiles", params, self.headers) 165 | 166 | def generateJWT(self, data=None): 167 | return doPost("profiles/generateJWT", data, self.headers) 168 | 169 | def unlinkSocial(self, data=None): 170 | return doDelete("profiles/social", data, self.headers) 171 | 172 | def postComment(self, data=None): 173 | return doPost("comments", data, self.headers) 174 | 175 | def getComments(self, params=None): 176 | if params is None: 177 | params = {} 178 | 179 | id = "" 180 | 181 | if 'id' in params: 182 | id = '/' + params.get('id') 183 | 184 | return doGet("comments" + id, params, self.headers) 185 | 186 | def deleteComments(self, data=None): 187 | if data is None: 188 | data = {} 189 | 190 | id = "" 191 | 192 | if 'id' in data: 193 | id = '/' + data.get('id') 194 | 195 | return doDelete("comments" + id, data, self.headers) 196 | 197 | def replyComment(self, data=None): 198 | return doPost("comments/reply", data, self.headers) 199 | 200 | def setAutoSchedule(self, data=None): 201 | return doPost("auto-schedule/set", data, self.headers) 202 | 203 | def deleteAutoSchedule(self, data=None): 204 | return doDelete("auto-schedule/delete", data, self.headers) 205 | 206 | 207 | def listAutoSchedule(self, params=None): 208 | return doGet("auto-schedule/list", params, self.headers) 209 | 210 | 211 | def registerWebhook(self, data=None): 212 | return doPost("hook/webhook", data, self.headers) 213 | 214 | def unregisterWebhook(self, data=None): 215 | return doDelete("hook/webhook", data, self.headers) 216 | 217 | def listWebhooks(self, params=None): 218 | return doGet("hook/webhook", params, self.headers) 219 | 220 | def getBrandByUser(self, params=None): 221 | return doGet("brand/byUser", params, self.headers) 222 | 223 | def generatePost(self, params=None): 224 | return doPost("generate/post", params, self.headers) 225 | 226 | def generateRewrite(self, params=None): 227 | return doPost("generate/rewrite", params, self.headers) 228 | 229 | def generateTranscription(self, params=None): 230 | return doPost("generate/transcription", params, self.headers) 231 | 232 | def generateTranslation(self, params=None): 233 | return doPost("generate/translate", params, self.headers) 234 | 235 | def generateAltText(self, params=None): 236 | return doPost("generate/altText", params, self.headers) 237 | 238 | def generateSentiment(self, params=None): 239 | return doPost("generate/sentiment", params, self.headers) 240 | 241 | def autoHashtags(self, params=None): 242 | return doPost("hashtags/auto", params, self.headers) 243 | 244 | def recommendHashtags(self, params=None): 245 | return doGet("hashtags/recommend", params, self.headers) 246 | 247 | def checkBannedHashtags(self, params=None): 248 | return doGet("hashtags/banned", params, self.headers) 249 | 250 | def shortLink(self, params=None): 251 | return doPost("links", params, self.headers) 252 | 253 | def shortLinkAnalytics(self, params=None): 254 | if params is None: 255 | params = {} 256 | 257 | id = "" 258 | 259 | if 'id' in params: 260 | id = '/' + params.get('id') 261 | 262 | return doGet("links" + id, params, self.headers) 263 | 264 | def reviews(self, params=None): 265 | return doGet("reviews", params, self.headers) 266 | 267 | def review(self, params=None): 268 | if params is None: 269 | params = {} 270 | 271 | id = "" 272 | 273 | if 'id' in params: 274 | id = '/' + params.get('id') 275 | 276 | return doGet("reviews" + id, params, self.headers) 277 | 278 | def reviewReply(self, params=None): 279 | return doPost("reviews", params, self.headers) 280 | 281 | def deleteReviewReply(self, params=None): 282 | return doDelete("reviews", params, self.headers) 283 | 284 | -------------------------------------------------------------------------------- /commands.txt: -------------------------------------------------------------------------------- 1 | New Setup: python3 setup.py install 2 | pip3 install twine 3 | pip3 install wheel 4 | pip install urllib3==1.26.15 requests-toolbelt==0.10.1 5 | 6 | Release: 7 | Delete: files in /dist 8 | Run: python3 setup.py sdist bdist_wheel 9 | For Test: twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose 10 | For Release: twine upload --skip-existing dist/* --verbose -------------------------------------------------------------------------------- /dist/social-post-api-1.2.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayrshare/social-post-api-python/0ec13a7ab1cf180ab3c0562e51e7159e967c08a1/dist/social-post-api-1.2.4.tar.gz -------------------------------------------------------------------------------- /dist/social_post_api-1.2.4-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ayrshare/social-post-api-python/0ec13a7ab1cf180ab3c0562e51e7159e967c08a1/dist/social_post_api-1.2.4-py3-none-any.whl -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import pathlib 2 | from setuptools import setup, find_packages 3 | 4 | HERE = pathlib.Path(__file__).parent 5 | 6 | VERSION = '1.2.4' 7 | PACKAGE_NAME = 'social-post-api' 8 | AUTHOR = 'Ayrshare' 9 | AUTHOR_EMAIL = 'support@ayrshare.com' 10 | URL = 'https://www.ayrshare.com' 11 | 12 | LICENSE = 'Apache License 2.0' 13 | DESCRIPTION = 'Social Media API: Schedule posts, get analytics, manage comments for Instagram, X/Twitter, Facebook, YouTube, LinkedIn, Google Business Profile, Pinterest, Telegram, TikTok, and Reddit.' 14 | KEYWORDS = "Ayrshare, Social Media API, Social Networks, Social Media Management, Social API, Social Publishing, Social Posting,Social Analytics, Social Automation, Agency Social, Multiple User Posting, Instagram, YouTube API, X API, Twitter API, Facebook API, LinkedIn API, Reddit API, Telegram API, Pinterest API, Google Business Profile API, TikTok API" 15 | LONG_DESCRIPTION = (HERE / "README.md").read_text() 16 | LONG_DESC_TYPE = "text/markdown" 17 | PROJECT_URLS={ 18 | 'Documentation': 'https://docs.ayrshare.com', 19 | 'Source': 'https://github.com/ayrshare/social-post-api-python', 20 | } 21 | 22 | INSTALL_REQUIRES = [ 23 | 'requests' 24 | ] 25 | 26 | setup(name=PACKAGE_NAME, 27 | version=VERSION, 28 | description=DESCRIPTION, 29 | long_description=LONG_DESCRIPTION, 30 | keywords=KEYWORDS, 31 | project_urls=PROJECT_URLS, 32 | long_description_content_type=LONG_DESC_TYPE, 33 | author=AUTHOR, 34 | license=LICENSE, 35 | author_email=AUTHOR_EMAIL, 36 | url=URL, 37 | install_requires=INSTALL_REQUIRES, 38 | packages=find_packages() 39 | ) 40 | -------------------------------------------------------------------------------- /social_post_api.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: social-post-api 3 | Version: 1.2.4 4 | Summary: Social Media API: Schedule posts, get analytics, manage comments for Instagram, X/Twitter, Facebook, YouTube, LinkedIn, Google Business Profile, Pinterest, Telegram, TikTok, and Reddit. 5 | Home-page: https://www.ayrshare.com 6 | Author: Ayrshare 7 | Author-email: support@ayrshare.com 8 | License: Apache License 2.0 9 | Project-URL: Documentation, https://docs.ayrshare.com 10 | Project-URL: Source, https://github.com/ayrshare/social-post-api-python 11 | Keywords: Ayrshare,Social Media API,Social Networks,Social Media Management,Social API,Social Publishing,Social Posting,Social Analytics,Social Automation,Agency Social,Multiple User Posting,Instagram,YouTube API,X API,Twitter API,Facebook API,LinkedIn API,Reddit API,Telegram API,Pinterest API,Google Business Profile API,TikTok API 12 | Description-Content-Type: text/markdown 13 | 14 | # Social Media APIs for Posting, Scheduling, and Analytics 15 | 16 | ![Ayrshare logo](https://www.ayrshare.com/wp-content/uploads/2020/08/ayr-logo-2156-reduced.png) 17 | 18 | The Social Media API is a Python wrapper SDK for [Ayrshare's APIs](https://www.ayrshare.com). While most of the capabliites are supported, the Python wrapper SDK is not as feature complete as the [Ayrshare's APIs](https://www.ayrshare.com/docs/introduction). 19 | The Social Media API is a Python wrapper SDK for [Ayrshare's APIs](https://www.ayrshare.com). While most of the capabliites are supported, the Python wrapper SDK is not as feature complete as the [Ayrshare's APIs](https://www.ayrshare.com/docs/introduction). 20 | 21 | ## What is Ayrshare? 22 | 23 | Ayrshare is a powerful set of APIs that enable you to send social media posts, get analytics, manage comments, do DMs, and more to *X/Twitter*, *Instagram*, *Facebook*, *LinkedIn*, *YouTube*, *Google Busienss Profile*, *Pinterest*, *TikTok*, *Reddit*, and *Telegram* on behalf of your users or clients. 24 | 25 | The Ayrshare Social API handles all the setup and maintenance for the social media networks. One API to rule them all (yeah, went there). See the full list of [full list of features](https://www.ayrshare.com/docs/apis/overview). 26 | The Ayrshare Social API handles all the setup and maintenance for the social media networks. One API to rule them all (yeah, went there). See the full list of [full list of features](https://www.ayrshare.com/docs/apis/overview). 27 | 28 | Get started with a [free plan](https://www.ayrshare.com/pricing), or if you have a platform or manage multiple users check out the [Business Plan](https://www.ayrshare.com/business-plan-for-multiple-users/). 29 | 30 | For more information on setup, see our installation [video](https://youtu.be/G8M6DZdtcMc) or our [Quick Start Guide](https://www.ayrshare.com/docs/quickstart). 31 | For more information on setup, see our installation [video](https://youtu.be/G8M6DZdtcMc) or our [Quick Start Guide](https://www.ayrshare.com/docs/quickstart). 32 | 33 | ## Installation 34 | 35 | `pip install social-post-api` 36 | 37 | ## Setup 38 | 39 | **1.** Create a free [Ayrshare account](https://app.ayrshare.com). 40 | 41 | ![alt Social Accounts Setup](https://www.ayrshare.com/wp-content/uploads/Ayrshare-login.png) 42 | 43 | **2.** Enable your social media accounts such as C/Twitter, Facebook, LinkedIn, Reddit, Instagram, Google Business Profile, Telegram, TikTok, or YouTube in the Ayrshare dashboard. 44 | 45 | ![alt Social Accounts Setup](https://www.ayrshare.com/wp-content/uploads/Ayrshare-social-linking.png) 46 | 47 | **3.** Copy your API Key from the Ayrshare dashboard. Used for authentication. 48 | 49 | ![alt API Key](https://www.ayrshare.com/wp-content/uploads/Ayrshare-API-key.png) 50 | 51 | ## Getting Started 52 | 53 | ### Initialize Social Media API 54 | 55 | Create a new Social Post object with your API Key. 56 | 57 | ``` python 58 | from ayrshare import SocialPost 59 | social = SocialPost('DJED-DKEP-SJWK-WJKS') # get an API Key at ayrshare.com 60 | ``` 61 | 62 | ### History, Post, Delete Example 63 | 64 | This simple example shows how to post, get history, and delete the post. This example assumes you have a free API key from [Ayrshare](https://www.ayrshare.com) and have enabled X/Twitter, Facebook, and LinkedIn. Note, Instagram, Telegram, YouTube, TikTok, and Reddit also available. 65 | 66 | ``` python 67 | from ayrshare import SocialPost 68 | social = SocialPost('8jKj782Aw8910dCN') # get an API Key at ayrshare.com 69 | 70 | # Post to Platforms Twitter, Facebook, and LinkedIn 71 | postResult = social.post({'post': 'Nice Posting 2', 'platforms': ['twitter', 'facebook', 'linkedin']}) 72 | print(postResult) 73 | 74 | # Delete 75 | deleteResult = social.delete({'id': postResult['id']}) 76 | print(deleteResult) 77 | 78 | # History 79 | print(social.history()) 80 | ``` 81 | 82 | ## Social API 83 | 84 | ### Post 85 | 86 | [Published a new post](https://www.ayrshare.com/docs/apis/post/overview) to the specified social networks either immediately or at scheduled future date with the Social API. Returns a promise that resolves to an object containing the post ID and post status (success, error). See the [post endpoint](https://www.ayrshare.com/docs/apis/post/post) for the full capabilities. 87 | 88 | ``` python 89 | postResponse = social.post({ 90 | # Required 91 | 'post': 'Best post ever!', 92 | 93 | # Required: Social media platforms to post. 94 | # Accepts an array of strings with values: "facebook", "twitter", "linkedin", "pinterest", "reddit", or "telegram". 95 | 'platforms': ['twitter', 'facebook', 'linkedin', 'pinterest', 'telegram', 'instagram'], 96 | 97 | # Optional: URLs of images to include in the post or for Instagram 98 | 'mediaUrls': ['https://img.ayrshare.com/012/gb.jpg'], 99 | 100 | # Optional: Datetime to schedule a future post. 101 | # Accepts an ISO-8601 UTC date time in format "YYYY-MM-DDThh:mm:ssZ". Example: 2021-07-08T12:30:00Z 102 | 'scheduleDate': '2020-08-07T15:17:00Z', 103 | 104 | # Optional: Shorten links in the post for all platforms similar to bit.ly. 105 | # Only URLS starting with http or https will be shortened. Default value: true. 106 | 'shorten_links': true 107 | }) 108 | ``` 109 | 110 | ### Delete 111 | 112 | Delete a post with a given post ID, obtained from the "post" response. Returns a promise with the delete status. Also, can bulk delete multiple IDs at once using the "bulk" key. See the [delete endpoint](https://www.ayrshare.com/docs/apis/post/delete-post) for more details. 113 | Delete a post with a given post ID, obtained from the "post" response. Returns a promise with the delete status. Also, can bulk delete multiple IDs at once using the "bulk" key. See the [delete endpoint](https://www.ayrshare.com/docs/apis/post/delete-post) for more details. 114 | 115 | ``` python 116 | deleteResponse = social.delete({ 117 | # Required 118 | 'id': 'POST ID', # Optional, but required if "bulk" not present 119 | 'bulk': ['Post ID 1', 'Post ID 2', ...] # Optional, but required if "id" not present 120 | }) 121 | ``` 122 | 123 | ### Get Post 124 | 125 | Get a post with a given post ID. Returns a promise that resolves to a post object. See the [get post endpoint](https://www.ayrshare.com/docs/apis/post/get-post) for more details. 126 | Get a post with a given post ID. Returns a promise that resolves to a post object. See the [get post endpoint](https://www.ayrshare.com/docs/apis/post/get-post) for more details. 127 | 128 | ``` python 129 | getResponse = social.getPost({ 130 | # Required 131 | 'id': 'POST ID', 132 | }) 133 | ``` 134 | 135 | ### Retry Post 136 | 137 | Retry a failed post with a given post ID. Returns a promise that resolves to an object with the post status. See the [retry post endpoint](https://www.ayrshare.com/docs/apis/post/retry-post) for more details. 138 | Retry a failed post with a given post ID. Returns a promise that resolves to an object with the post status. See the [retry post endpoint](https://www.ayrshare.com/docs/apis/post/retry-post) for more details. 139 | 140 | ``` python 141 | retryResponse = social.retryPost({ 142 | # Required 143 | 'id': 'POST ID', 144 | }) 145 | ``` 146 | 147 | ### Update Post 148 | 149 | Update a post with a given post ID. Returns a promise that resolves to an object with status and update info. See the [update post endpoint](https://www.ayrshare.com/docs/apis/post/retry-post) for more details. 150 | 151 | ``` python 152 | updateResponse = social.updatePost({ 153 | 'id': 'POST ID', # Required: ID of the post to update 154 | 'scheduleDate': '2024-08-07T15:17:00Z', # Optional: Datetime to schedule a future post. 155 | 'approved': 'true', # Optional: Approve the post to send it. 156 | 'youTubeOptions': { # Optional: YouTube specific options 157 | 'title': 'New Title', 158 | 'description': 'New Description', 159 | 'visibility': 'unlisted', 160 | 'categoryId': 24, 161 | }, 162 | 'notes': 'New notes', # optional: Notes about the post 163 | }) 164 | ``` 165 | 166 | ### History 167 | 168 | Get a [history](https://www.ayrshare.com/docs/apis/history/overview) of all posts and their current status in descending order. Returns a promise that resolves to an array of post objects. See the [history endpoint](https://www.ayrshare.com/docs/apis/history/get-history) for more details. 169 | 170 | ``` python 171 | historyResponse = social.history({ 172 | 'lastRecords': 10, # optional: returns the last X number of history records 173 | 'lastDays': 30, # optional: returns the last X number of days of history records. Defaults to 30 if not present. 174 | }) 175 | ``` 176 | 177 | ### Upload Media 178 | 179 | Upload and store a new image. Returns a URL referencing the image. Can be used in "image_url" in "post". See the [media endpoint](https://www.ayrshare.com/docs/apis/media/overview) for more details. 180 | 181 | ``` python 182 | uploadResponse = social.upload({ 183 | # Required: The image as a Base64 encoded string. Example encoding: https://www.base64-image.de/ 184 | 'file': 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...', 185 | 186 | # Optional 187 | 'fileName': 'test.png', 188 | 189 | # Optional 190 | 'description': 'best image' 191 | }) 192 | ``` 193 | 194 | ### Get Media 195 | 196 | Get all media URLS. Returns a promise that resolves to an array of URL objects. See the [media endpoint](https://www.ayrshare.com/docs/apis/media/get-media-in-gallery) for more details. 197 | Get all media URLS. Returns a promise that resolves to an array of URL objects. See the [media endpoint](https://www.ayrshare.com/docs/apis/media/get-media-in-gallery) for more details. 198 | 199 | ``` python 200 | mediaResponse = social.media() 201 | ``` 202 | 203 | ### Verify Media Exists 204 | 205 | Verify that the media file exists when uploaded. See the [media verify exists endpoint](https://www.ayrshare.com/docs/apis/media/verify-media-url) for more details. 206 | Verify that the media file exists when uploaded. See the [media verify exists endpoint](https://www.ayrshare.com/docs/apis/media/verify-media-url) for more details. 207 | 208 | ``` python 209 | verifyResponse = social.verifyMediaExists({ 210 | # Required: URL of the media file 211 | 'mediaUrl': 'https://img.ayrshare.com/012/gb.jpg', 212 | }) 213 | ``` 214 | 215 | ### Resize Image 216 | 217 | Get image resized according to social network requirements. See the [resize image endpoint](https://www.ayrshare.com/docs/apis/media/resize) for more details. 218 | Get image resized according to social network requirements. See the [resize image endpoint](https://www.ayrshare.com/docs/apis/media/resize) for more details. 219 | 220 | ``` python 221 | resizeResponse = social.resizeImage({ 222 | 'imageUrl': "https://theImage.jpg", # required: URL of the image to resize 223 | 'platform': "facebook" # required: Platform to resize the image for. 224 | 'watermarkUrl': "https:#theWatermark.png", # optional: URL of the watermark image to add to the image. 225 | 'effects': { color: "#A020F0" } # optional: Change opacity, colors, etc. See endpoint for more details. 226 | 'dimensions': { width: 1200, height: 628 } # optional: Width and height of the image. Required if platform is not specified. 227 | 'mode': "blur" # optional. See endpoint for more details. 228 | }) 229 | ``` 230 | 231 | ### User 232 | 233 | Get data about the logged in [user](https://www.ayrshare.com/docs/apis/user/overview), such as post quota, used quota, active social networks, and created date. See the [user endpoint](https://www.ayrshare.com/docs/apis/user/profile-details) for more details. 234 | 235 | ``` python 236 | user = social.user() 237 | ``` 238 | 239 | ### Shorten URL 240 | 241 | Shorten a URL and return the shortened URL. See the [shorten endpoint](https://www.ayrshare.com/docs/apis/links/create-short-link) for more details. 242 | 243 | ``` python 244 | shortenResponse = social.shorten({ 245 | # Required: URL to shorten 246 | 'url': 'https://theURLtoShorten.com/whatmore', 247 | }) 248 | ``` 249 | 250 | ### Analytics 251 | 252 | Get [analytics](https://www.ayrshare.com/docs/apis/analytics/overview) on shortened links and shares, likes, shares, and impressions with for a post or at the accounts level. See the [analytics endpoint](https://www.ayrshare.com/docs/apis/analytics/post) for more details. 253 | 254 | ``` python 255 | analytics = social.analyticsLinks({ 256 | # Optional range 1-7, default 1 day. 257 | 'lastDays': 3 258 | }) 259 | ``` 260 | 261 | ``` python 262 | analytics = social.analyticsPost({ 263 | 'id': 'Post ID', 264 | 'platforms': ['twitter', 'linkedin'] # optional: filter by platform 265 | }) 266 | ``` 267 | 268 | ### Social Analytics 269 | 270 | Get analytics on a social network. Returns a promise that resolves to an object containing the analytics data. See the [social analytics endpoint](https://www.ayrshare.com/docs/apis/analytics/social) for more details. 271 | 272 | ```python 273 | analytics = social.analyticsSocial({ 274 | 'platforms': ['twitter', 'linkedin'] # required 275 | }) 276 | ``` 277 | 278 | ### Add an RSS or Substack Feed 279 | 280 | Add a new RSS or Substack feed to auto post all new articles. Returns a promise that resolved to an object containing the feed ID. See [How to Automate Your Blog or Newsletter](https://www.ayrshare.com/how-to-automatically-post-your-blog-or-newsletter-to-social-media/) for more info. 281 | 282 | ``` python 283 | feedResponse = social.addFeed({ 284 | # Required: URL to shorten 285 | 'url': 'https://theRSSFeed', 286 | 287 | # Optional: Value: "rss" or "substack". 288 | # If not set, defaults to "rss" 289 | 'type': 'RSS', 290 | }) 291 | ``` 292 | 293 | ### Delete an RSS or Substack Feed 294 | 295 | Delete an RSS feed for a given ID. 296 | 297 | ``` python 298 | feedResponse = social.deleteFeed({ 299 | # Required: ID of the feed 300 | 'id': 'Feed ID', 301 | }) 302 | ``` 303 | 304 | ### Get Feeds 305 | 306 | Get all registered RSS feeds. Returns a promise that resolves to an array of feed objects. See the [RSS Feeds](https://www.ayrshare.com/docs/apis/feeds/overview) for more details. 307 | 308 | ``` python 309 | feedsResponse = social.getFeeds() 310 | ``` 311 | 312 | ### Update Feed 313 | 314 | Update an RSS feed for a given ID. Returns a promise that resolves to an object containing the feed ID. See the [update feed endpoint](https://www.ayrshare.com/docs/apis/feeds/update-feed) for more details. 315 | Update an RSS feed for a given ID. Returns a promise that resolves to an object containing the feed ID. See the [update feed endpoint](https://www.ayrshare.com/docs/apis/feeds/update-feed) for more details. 316 | 317 | ``` python 318 | feedResponse = social.updateFeed({ 319 | 'id': 'Feed ID', # required: ID of the feed 320 | 'useFirstImage': 'true', # optional: Use the first image in the article to add to the post. 321 | 'autoHashtag': 'true', # optional: Automatically add hashtags to the post. 322 | }) 323 | ``` 324 | 325 | ### Get Comments 326 | 327 | Get comments for a post. See the [comments endpoint](https://www.ayrshare.com/docs/apis/comments/overview) for more details. 328 | 329 | ``` python 330 | getCommentsResponse = social.getComments({ 331 | # Required: ID of the Post 332 | 'id': 'Post Id', 333 | }) 334 | ``` 335 | 336 | ### Post a Comment 337 | 338 | Add a comment to a post. See the [create comment endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment) for more details. 339 | 340 | ``` python 341 | postCommentResponse = social.postComment({ 342 | # Required: ID of the Post 343 | 'id': 'Post Id', 344 | 'platforms': ['facebook', 'instagram'], 345 | 'comment': 'The best comment ever!', 346 | }) 347 | ``` 348 | 349 | ### Delete Comments 350 | 351 | Delete either a single comment or all comments under a post that were sent via Ayrshare. Available for Facebook, Instagram, LinkedIn, Reddit, TikTok, X/Twitter, and YouTube. See the [delete comments endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment) for more details. 352 | 353 | ``` python 354 | deleteCommentResponse = social.deleteComments({ 355 | 'id': "Pkdo9sjk2", # required: Post top-level ID or social comment ID 356 | 'platforms': ["instagram", "facebook"], # optional: Required only if using the social comment id. 357 | }) 358 | ``` 359 | 360 | ### Reply Comment 361 | 362 | Reply to a comment. Available for Facebook, Instagram, LinkedIn, TikTok, X/Twitter, and YouTube. See the [reply comment endpoint](https://www.ayrshare.com/docs/apis/comments/reply-to-comment) for more details. 363 | Reply to a comment. Available for Facebook, Instagram, LinkedIn, TikTok, X/Twitter, and YouTube. See the [reply comment endpoint](https://www.ayrshare.com/docs/apis/comments/reply-to-comment) for more details. 364 | 365 | ``` python 366 | replyCommentResponse = social.replyComment({ 367 | 'commentId': 'Pkdo9sjk2', # required: The Ayrshare commentId returned from the POST comment endpoint. Be sure to use the top level commentId. 368 | 'platforms': ['instagram', 'facebook'], # required: Array of platforms to post the reply. Values: facebook, instagram, linkedin, tiktok, twitter, youtube 369 | 'comment': 'What a comment' # required: The reply to add to the comment. 370 | }) 371 | ``` 372 | 373 | ## Business Functions for Multiple Users - Business or Enterprise Plan Required 374 | 375 | The [Business Plan](https://www.ayrshare.com/business-plan-for-multiple-users/) allows you to create, manage, and post on behalf of client profiles via the API or Dashboard GUI. You can [integrate](https://www.ayrshare.com/docs/multiple-users/business-plan-overview) Ayrshare into your platform, product, or agency and give your clients social media capabilites. Please [contact us](mailto:contact@ayrshare.com) with any questions. 376 | 377 | A User Profile PROFILE_KEY can be set with the `setProfileKey` method. 378 | 379 | ``` python 380 | social = SocialPost(API_KEY) 381 | social.setProfileKey('PROFILE_KEY') 382 | ``` 383 | 384 | Replace `PROFILE_KEY` with the PROFILE_KEY of the profile you want to use. 385 | 386 | Please see the [Authorization](https://www.ayrshare.com/docs/apis/overview#authorization) docs for more details. 387 | 388 | ### Create Profile 389 | 390 | Create a new account [profile](https://www.ayrshare.com/docs/apis/profiles/overview) under the primary account. See the [create profile endpoint](https://www.ayrshare.com/docs/apis/profiles/create-profile) for more details. 391 | 392 | ``` python 393 | createProfileResponse = social.createProfile({ 394 | # Required: title 395 | 'title': 'New Profile Title', 396 | }) 397 | ``` 398 | 399 | ### Delete Profile 400 | 401 | Delete a profile owned by the primary account. See the [delete profile endpoint](https://www.ayrshare.com/docs/apis/profiles/delete-profile) for more details. 402 | Delete a profile owned by the primary account. See the [delete profile endpoint](https://www.ayrshare.com/docs/apis/profiles/delete-profile) for more details. 403 | 404 | ``` python 405 | deleteProfileResponse = social.deleteProfile({ 406 | # Required: profileKey - the API Key of the profile to delete 407 | 'profileKey': 'JI9s-kJII-9283-OMKM', 408 | }) 409 | ``` 410 | 411 | ### Generate a JWT URL 412 | 413 | Generate a JWT Token and URL used for authorizing a user's access to the Social Account linking page. See the [generate JWT endpoint](https://www.ayrshare.com/docs/apis/profiles/generate-jwt) for more details. 414 | Generate a JWT Token and URL used for authorizing a user's access to the Social Account linking page. See the [generate JWT endpoint](https://www.ayrshare.com/docs/apis/profiles/generate-jwt) for more details. 415 | 416 | ``` python 417 | generateJWTResponse = social.generateJWT({ 418 | 'domain': 'mydomain', 419 | 'privateKey': 'private key data...', 420 | 'profileKey': 'JI9s-kJII-9283-OMKM', 421 | }) 422 | ``` 423 | 424 | ### Update Profile 425 | 426 | Update a profile owned by the primary account. See the [update profile endpoint](https://www.ayrshare.com/docs/apis/profiles/update-profile) for more details. 427 | Update a profile owned by the primary account. See the [update profile endpoint](https://www.ayrshare.com/docs/apis/profiles/update-profile) for more details. 428 | 429 | ``` python 430 | updateProfileResponse = social.updateProfile({ 431 | 'profileKey': 'JI9s-kJII-9283-OMKM', #Required: profileKey - the API Key of the profile to update 432 | 'title': 'This is a great new title' #Optional: the new title of the profile 433 | 'disableSocial': ['facebook', 'linkedin'] #Optional: an array of social networks to disable 434 | 'hideTitle': 'true' #Optional: hide the title of the profile 435 | 'displayTitle': 'true' #Optional: display the title of the profile 436 | }) 437 | ``` 438 | 439 | ### Get Profiles 440 | 441 | Get all the profiles associated with the primary account. See the [get profile endpoint](https://www.ayrshare.com/docs/apis/profiles/get-profiles) for more details. 442 | Get all the profiles associated with the primary account. See the [get profile endpoint](https://www.ayrshare.com/docs/apis/profiles/get-profiles) for more details. 443 | 444 | ``` python 445 | getProfileResponse = social.getProfiles() 446 | ``` 447 | 448 | ### Unlink Social Network 449 | 450 | Unlink a social account for a given user profile owned by the primary account. See the [unlink social network endpoint](https://www.ayrshare.com/docs/apis/profiles/unlink-social-network) for more details. 451 | Unlink a social account for a given user profile owned by the primary account. See the [unlink social network endpoint](https://www.ayrshare.com/docs/apis/profiles/unlink-social-network) for more details. 452 | 453 | ``` python 454 | unlinkResponse = social.unlinkSocial({ 455 | 'profileKey': "JI9s-kJII-9283-OMKM", # Required: profileKey - the API Key of the profile to unlink for. 456 | 'platform': "facebook" 457 | }) 458 | ``` 459 | 460 | ### Get Brand Info on a User 461 | 462 | Get brand information on users and companies public social media accounts. See the [brand endpoint](https://www.ayrshare.com/docs/apis/brand/overview) for more details. 463 | 464 | ``` python 465 | brandResponse = social.getBrandByUser({ 466 | 'platforms': ['instagram', 'facebook'], 467 | 'instagramUser': '@ayrshare', 468 | 'facebookUser': 'ayrshare', 469 | }) 470 | ``` 471 | 472 | ### Auto Hashtags 473 | 474 | Automatically add hashtags to your post. See the [auto hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/overview) for more details. 475 | 476 | ``` python 477 | autoHashtagsResponse = social.autoHashtags({ 478 | 'post': 'I love social media', # required: Post text to add hashtags for. 479 | 'position': 'auto' # optional: Position of the hashtags. Values: 'auto', 'end'. Default: 'auto'. 480 | 'max': 2 # optional: Maximum number of hashtags to add, ranging 1-5. Default: 2. 481 | }) 482 | ``` 483 | 484 | ### Recommend Hashtags 485 | 486 | Get suggestions for hashtags based on a keyword. See the [recommend hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/recommend-hashtags) for more details. 487 | Get suggestions for hashtags based on a keyword. See the [recommend hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/recommend-hashtags) for more details. 488 | 489 | ``` python 490 | recommendHashtagsResponse = social.recommendHashtags({ 491 | 'keyword': 'social media', # required: Keyword to get hashtags for. 492 | }) 493 | ``` 494 | 495 | ### Check Banned Hashtags 496 | 497 | Check if a hashtag is banned on Instagram or other social networks. See the [check banned hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/check-hashtags) for more details. 498 | Check if a hashtag is banned on Instagram or other social networks. See the [check banned hashtags endpoint](https://www.ayrshare.com/docs/apis/hashtags/check-hashtags) for more details. 499 | 500 | ``` python 501 | checkBannedHashtagsResponse = social.checkBannedHashtags({ 502 | 'hashtag': 'socialmedia', # required: Hashtag to check. 503 | }) 504 | ``` 505 | 506 | ### Get All Reviews 507 | 508 | Retrieve all the reviews for the specified platform. See the [get all reviews endpoint](https://www.ayrshare.com/docs/apis/reviews/get-reviews) for more details. 509 | Retrieve all the reviews for the specified platform. See the [get all reviews endpoint](https://www.ayrshare.com/docs/apis/reviews/get-reviews) for more details. 510 | 511 | ``` python 512 | allReviewsResponse = social.reviews({ 513 | 'platform': 'facebook', # required: Platform to get reviews for. Currently available: "facebook", "gmb" 514 | }) 515 | ``` 516 | 517 | ### Get Single Review 518 | 519 | Retrieve a single review. See the [get single review endpoint](https://www.ayrshare.com/docs/apis/reviews/get-one-review) for more details. 520 | Retrieve a single review. See the [get single review endpoint](https://www.ayrshare.com/docs/apis/reviews/get-one-review) for more details. 521 | 522 | ``` python 523 | singleReviewResponse = social.review({ 524 | 'id': 'Review ID', # required 525 | 'platform': 'gmb', # required: Platform to get review for. Currently available: "gmb" 526 | }) 527 | ``` 528 | 529 | ### Reply to Review 530 | 531 | Reply to a review. See the [reply to review endpoint](https://www.ayrshare.com/docs/apis/reviews/reply-review) for more details. 532 | Reply to a review. See the [reply to review endpoint](https://www.ayrshare.com/docs/apis/reviews/reply-review) for more details. 533 | 534 | ``` python 535 | replyReviewResponse = social.replyReview({ 536 | 'reviewId': 'Review ID', # required: Review ID to reply to. 537 | 'platform': 'facebook', # required: Platform to reply to review for. Currently available: "facebook", "gmb" 538 | 'reply': 'Thank you for the review' # required: Text of the reply to the review. 539 | }) 540 | ``` 541 | 542 | ### Delete Review Reply 543 | 544 | Delete a review reply. See the [delete review reply endpoint](https://www.ayrshare.com/docs/apis/reviews/reply-review) for more details. 545 | 546 | ``` python 547 | deleteReplyReviewResponse = social.deleteReplyReview({ 548 | 'reviewId': 'Review ID', # required: Review ID to delete reply for. 549 | 'platform': 'gmb', # required: Platform to delete reply for. Currently available: "gmb" 550 | }) 551 | ``` 552 | 553 | ## Max Pack Required 554 | 555 | ### Generate Post 556 | 557 | Generate a new social post using ChatGPT. Token limits applicable. See the [generate post endpoint](https://www.ayrshare.com/docs/apis/generate/post-text) for more details. 558 | Generate a new social post using ChatGPT. Token limits applicable. See the [generate post endpoint](https://www.ayrshare.com/docs/apis/generate/post-text) for more details. 559 | 560 | ``` python 561 | generatePostResponse = social.generatePost({ 562 | 'text': 'I love social media', # required: Description of what the post should be about. 563 | 'hashtags': 'true', #optional: Include hashtags in the post. Default: true 564 | 'emojis': 'true', # optional: Include emojis in the post. Default: false 565 | 'twitter': 'true', # optional: Construct a post 280 or few characters. Default: false 566 | }) 567 | ``` 568 | 569 | ### Generate Rewrite 570 | 571 | Generate variations of a social media post using ChatGPT. Token limits applicable. See the [generate rewrite endpoint](https://www.ayrshare.com/docs/apis/generate/rewrite-post) for more details. 572 | Generate variations of a social media post using ChatGPT. Token limits applicable. See the [generate rewrite endpoint](https://www.ayrshare.com/docs/apis/generate/rewrite-post) for more details. 573 | 574 | ``` python 575 | generateRewriteResponse = social.generateRewrite({ 576 | 'post': 'I love social media', # required: The post text to be rewritten. 577 | 'emojis': 'true', # optional: Include emojis in the post. Default: false 578 | 'hashtags': 'true', # optional: Include hashtags in the post. Default: false 579 | 'twitter': 'true', # optional: Construct a post 280 or few characters. Default: false 580 | 'rewrites': 5, # optional: Number of rewrites to generate. Default: 5 581 | }) 582 | ``` 583 | 584 | ### Generate Transcription 585 | 586 | Provide a transcription of a video file. See the [generate transcription endpoint](https://www.ayrshare.com/docs/apis/generate/transcribe-video) for more details. 587 | Provide a transcription of a video file. See the [generate transcription endpoint](https://www.ayrshare.com/docs/apis/generate/transcribe-video) for more details. 588 | 589 | ``` python 590 | generateTranscriptionResponse = social.generateTranscription({ 591 | 'videoUrl': 'https://theVideo.mp4', # required: URL encoded video URL. The video must be hosted by Ayrshare. 592 | }) 593 | ``` 594 | 595 | ### Generate Translation 596 | 597 | Translate text for a post to over 100 different languages. See the [generate translation endpoint](https://www.ayrshare.com/docs/apis/generate/translate-post) for more details. 598 | Translate text for a post to over 100 different languages. See the [generate translation endpoint](https://www.ayrshare.com/docs/apis/generate/translate-post) for more details. 599 | 600 | ``` python 601 | generateTranslationResponse = social.generateTranslation({ 602 | 'text': 'I love social media', # required: The text to be translated. 603 | 'lang': 'es', # required: The language code to translate the text to. 604 | }) 605 | ``` 606 | 607 | ### Generate Sentiment Analysis 608 | 609 | Generate a sentiment analysis on a social media post or comment to understand if the text is positive, negative, or neutral and recommendations on improving the text for a more positive reaction. See the [generate sentiment analysis endpoint](https://www.ayrshare.com/docs/apis/generate/sentiment) for more details. 610 | 611 | ``` python 612 | generateSentiment= social.generateSentiment({ 613 | 'text': 'I love social media' # required: The text to generate a sentiment analysis for. 614 | }) 615 | ``` 616 | 617 | ### Generate Alt Text 618 | 619 | Create AI-generated alt text for your images. See the [generate alt text endpoint](https://www.ayrshare.com/docs/apis/generate/sentiment) for more details. 620 | 621 | ``` python 622 | generateAltTextResponse = social.generateAltText({ 623 | 'url': 'https://theImage.jpg', # required: URL of the image to generate alt text for. 624 | 'keywords': ['social media', 'ayrshare'], # optional: Keywords to help the AI generate better alt text. 625 | 'lang': 'en' # optional: The language code to generate the alt text in. Default: 'en' 626 | }) 627 | ``` 628 | 629 | ### Shorten link 630 | 631 | Provide a URL and a shortened link will be returned. See the [shorten link endpoint](https://www.ayrshare.com/docs/apis/links/overview) for more details. 632 | 633 | ``` python 634 | shortenLinkResponse = social.shortLink({ 635 | 'url': 'https://theURL.com', # required: URL to shorten. 636 | 'utmId': '1234', # optional: UTM ID to track the link. See more details about utm parameters at endpoint link above. 637 | 'utmSource': 'source', # optional 638 | 'utmMedium': 'medium', # optional 639 | 'utmCampaign': 'campaign', # optional 640 | 'utmTerm': 'term', # optional 641 | 'utmContent': 'content', # optional 642 | }) 643 | ``` 644 | 645 | ### Analytics for Shortened Links 646 | 647 | Return analytics for all shortened links or a single link for a given link ID. See the [analytics link endpoint](https://www.ayrshare.com/docs/apis/links/link-analytics) for more details. 648 | Return analytics for all shortened links or a single link for a given link ID. See the [analytics link endpoint](https://www.ayrshare.com/docs/apis/links/link-analytics) for more details. 649 | 650 | ``` python 651 | analyticsLinkResponse = social.shortLinkAnalytics({ 652 | 'id': 'Link ID', # optional: Link ID to get analytics for. 653 | 'fromCreatedDate': '2023-07-08T12:30:00Z', # optional: Get history of links shortened after this date. 654 | 'toCreatedDate': '2023-07-08T12:30:00Z', # optional: Get history of links shortened before this date. 655 | 'fromClickDate': '2023-07-08T12:30:00Z', # optional: Get history of links clicked after this date. 656 | 'toClickDate': '2023-07-08T12:30:00Z', # optional: Get history of links clicked before this date. 657 | }) 658 | ``` 659 | 660 | ### Additional Calls 661 | 662 | - [Webhooks endpoints](https://www.ayrshare.com/docs/apis/webhooks/overview) 663 | - [Webhooks endpoints](https://www.ayrshare.com/docs/apis/webhooks/overview) 664 | - unregisterWebhook 665 | - listWebhook 666 | - setAutoSchedule 667 | - deleteAutoSchedule 668 | - listAutoSchedule 669 | 670 | ## Other Packages & Integrations 671 | 672 | We have other package and integrations such as [Node NPM](https://www.ayrshare.com/docs/packages-guides/nodejs), [Bubble.io](https://www.ayrshare.com/docs/packages-guides/bubble), [Make](https://www.ayrshare.com/docs/packages-guides/make), and [Airtable](https://www.ayrshare.com/docs/packages-guides/airtable). 673 | 674 | ### Information and Support 675 | 676 | Additional examples, responses, etc. can be found at: 677 | 678 | [RESTful API Endpoint Docs](https://www.ayrshare.com/docs/apis/overview) 679 | [RESTful API Endpoint Docs](https://www.ayrshare.com/docs/apis/overview) 680 | 681 | [GitHub](https://github.com/ayrshare/social-post-api-python) 682 | 683 | See our [changelog](https://www.ayrshare.com/docs/whatsnew/latest) for the latest and greatest. 684 | See our [changelog](https://www.ayrshare.com/docs/whatsnew/latest) for the latest and greatest. 685 | 686 | Please [contact us](mailto:support@ayrshare.com) with your questions, or just to give us shout-out 📢! 687 | -------------------------------------------------------------------------------- /social_post_api.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | README.md 2 | setup.py 3 | ayrshare/__init__.py 4 | ayrshare/ayrshare.py 5 | social_post_api.egg-info/PKG-INFO 6 | social_post_api.egg-info/SOURCES.txt 7 | social_post_api.egg-info/dependency_links.txt 8 | social_post_api.egg-info/requires.txt 9 | social_post_api.egg-info/top_level.txt -------------------------------------------------------------------------------- /social_post_api.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /social_post_api.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | requests 2 | -------------------------------------------------------------------------------- /social_post_api.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | ayrshare 2 | -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | import json, pprint 2 | from ayrshare import SocialPost 3 | 4 | # Add your API Key in a file names API-KEY.json { 'key': 'API KEY'} 5 | print("Loading API Key...") 6 | with open('./API-KEY.json') as f: 7 | API_KEY = json.load(f) 8 | 9 | print("Initializing SocialPost...") 10 | 11 | social = SocialPost(API_KEY["key"]) 12 | social.setProfileKey('PROFILE_KEY') 13 | pp = pprint.PrettyPrinter(indent=4) 14 | 15 | print("Running Tests...") 16 | 17 | # Post to Platforms 18 | postResult = social.post({'randomPost': True, 'platforms': ['twitter']}) 19 | print(postResult) 20 | 21 | # Get Post 22 | getResult = social.getPost({ 'id': postResult['posts'][0]['id']}) 23 | print(getResult) 24 | 25 | # Retry Post 26 | # retryResult = social.retryPost({'id': 'sEe25WkXQnAz188IrrzX'}) 27 | # print(retryResult) 28 | 29 | # Update Post 30 | #updateResult = social.updatePost({'id': 'L1chosWRlwaur5fXJU5v', 'scheduleDate': '2024-12-31T12:31:00Z'}) 31 | #print(updateResult) 32 | 33 | # Delete the Post 34 | deleteResult = social.delete({'id': postResult['posts'][0]['id']}) 35 | print(deleteResult) 36 | 37 | # Get History 38 | print(social.history()) 39 | 40 | # Verify Media Exists 41 | #print(social.verifyMediaExists({'mediaUrl': 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885_1280.jpg'})) 42 | 43 | # Get Media Upload URL 44 | #print(social.mediaUploadUrl({ 'fileName': 'tree.jpg', 'contentType': 'image/jpeg'})) 45 | 46 | # Get Media Meta 47 | #print(social.mediaMeta({'url': 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885_1280.jpg'})) 48 | 49 | # Resize Image 50 | #print(social.resizeImage({'imageUrl': 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885_1280.jpg', 'platform': 'twitter'})) 51 | 52 | # Get Analytics Post 53 | #print(social.analyticsPost({'id': 'sEe25WkXQnAz188IrrzX'})) 54 | 55 | # Get Analytics Social 56 | #print(social.analyticsSocial({'platforms': ['twitter', 'linkedin', 'facebook']})) 57 | 58 | # Add Feed 59 | #print(social.addFeed({'url': 'https://www.ayrshare.com/feed.xml'})) 60 | 61 | # Delete Feed 62 | #print(social.deleteFeed({'id': 'JjSuWHtjML0SXhH5-MUrE'})) 63 | 64 | # Get Feed 65 | #print(social.getFeeds()) 66 | 67 | # Update Feed 68 | #print(social.updateFeed({'id': 'BArIfIZjJAH_rcKV07Rvy', 'autoHashtag': 'true'})) 69 | 70 | # Update Profile 71 | #print(social.updateProfile({'profileKey': '1CCPGDX-ZZT4J2Z-H7H3NRJ-A52SZ54', 'title': 'Test Profile'})) 72 | 73 | # Get Profiles 74 | #print(social.getProfiles()) 75 | 76 | # Unlink Social 77 | #print(social.unlinkSocial({'platform': 'twitter'})) 78 | 79 | # Post Comment 80 | #print(social.postComment({'id': 'XOVUGutufIy5UZFb01e0', 'comment': 'Great post on Ayrshare!'})) 81 | 82 | # Get Comments 83 | #print(social.getComments({'id': 'XOVUGutufIy5UZFb01e0'})) 84 | 85 | # Delete Comments 86 | #print(social.deleteComments({'id': 'XOVUGutufIy5UZFb01e0'})) 87 | 88 | # Reply Comment 89 | #print(social.replyComment({'commentId': 'ACwgIY0QX1Zmvs6qU2pl0', 'comment': 'Replying to the comment', 'platforms': ['instagram']})) 90 | 91 | # Get Brand By User 92 | #print(social.getBrandByUser({'platforms': ['twitter', 'instagram'], 'twitterUser': 'postpostpost121', 'instagramUser': '@ayrshare'})) 93 | 94 | # Generate Post 95 | #print(social.generatePost({'text': 'Yay'})) 96 | 97 | # Generate Rewrite 98 | #print(social.generateRewrite({'post': 'Yay'})) 99 | 100 | # Generate Transcription 101 | # print(social.generateTranscription({'videoUrl': 'https://img.ayrshare.com/random/landscape5.mp4'})) 102 | 103 | # Generate Translation 104 | #print(social.generateTranslation({'text': 'Hello', 'lang': 'es'})) 105 | 106 | # Generate Alt Text 107 | #print(social.generateAltText({'url': 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885_1280.jpg'})) 108 | 109 | # Auto Hashtags 110 | #print(social.autoHashtags({'post': 'The best post ever!'})) 111 | 112 | # Recommend Hashtags 113 | #print(social.recommendHashtags({'keyword': 'food'})) 114 | 115 | # Check Banned Hashtags 116 | # print(social.checkBannedHashtags({'hashtag': 'food'})) 117 | 118 | # Get short link 119 | #print(social.shortLink({'url': 'https://www.ayrshare.com'})) 120 | 121 | # Short link analytics 122 | #print(social.shortLinkAnalytics({'id': 'qR--d8'})) 123 | 124 | # Get Reviews 125 | #print(social.reviews({ 'platform': 'facebook'})) 126 | 127 | # Get Single Review 128 | #print(social.review({ 'platform': 'facebook', 'id': '10114455408676943'})) 129 | 130 | # Reply to Review 131 | #print(social.reviewReply({ 'platform': 'facebook', 'reviewId': '10114455408676943', 'reply': 'Thanks for the review!'})) 132 | 133 | # Delete Review Reply 134 | #print(social.deleteReviewReply({ 'platform': 'gmb', 'reviewId': '10114455408676943'})) --------------------------------------------------------------------------------