> ## Documentation Index
> Fetch the complete documentation index at: https://ayrshare.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Python PyPI

> Ayrshare के लिए Python PyPI क्लाइंट पैकेज

## अवलोकन

Ayrshare का [Social-Post-API PyPI Package](https://pypi.org/project/social-post-api/) आपको Ayrshare API को अपने Python ऐप में एकीकृत करने की अनुमति देता है।

### इंस्टॉलेशन

यदि आप सर्वर-साइड पर Python का उपयोग करते हैं तो [Social-Post-API PyPI Package](https://pypi.org/project/social-post-api/) इंस्टॉल करें। यह पैकेज RESTful कॉल्स को रैप करके कॉल्स को सरल बनाता है।

[Ayrshare Dashboard](https://app.ayrshare.com/api) में अपना गुप्त API Key प्राप्त करके शुरुआत करें।

इसके बाद, Python पैकेज इंस्टॉल करें:

```bash theme={"system"}
pip install social-post-api
```

### सामान्य उपयोग

Post, History, और Delete के उदाहरण। अधिक जानकारी के लिए कृपया [PyPI Package](https://pypi.org/project/social-post-api/) देखें।

<Info>
  **X/Twitter पर पोस्ट कर रहे हैं?** 31 मार्च, 2026 से, Ayrshare के माध्यम से X/Twitter संचालन के लिए आपके स्वयं के X Developer App क्रेडेंशियल्स की आवश्यकता होगी — Ayrshare इसे हर X-बाउंड कॉल पर लागू करता है। अपने अनुरोध में 2 BYO हेडर्स जोड़ें। विवरण के लिए [सेटअप गाइड](/dashboard/connect-social-accounts/x-twitter-byo-keys) देखें।
</Info>

v1.3.0 के अनुसार SDK में एक `set_twitter_byo(api_key, api_secret)` हेल्पर शामिल है जो प्रत्येक बाद के अनुरोध में दो आवश्यक `X-Twitter-OAuth1-*` हेडर्स को अटैच करता है:

```python theme={"system"}
from ayrshare import SocialPost

social = SocialPost(API_KEY)
social.set_twitter_byo(MY_X_API_KEY, MY_X_API_SECRET)

social.post({"post": "Hello from BYO", "platforms": ["twitter"]})
```

हेडर्स हटाने के लिए `clear_twitter_byo()` का उपयोग करें — यह तब उपयोगी है जब एक ही SDK इंस्टेंस को कई टेनेंट्स के बीच पुन: उपयोग किया जा रहा हो:

```python theme={"system"}
social.clear_twitter_byo().set_twitter_byo(next_tenant_key, next_tenant_secret)
```

```python theme={"system"}
from ayrshare import SocialPost
social = SocialPost('8jKj782Aw8910dCN') # get an API Key at ayrshare.com

# Required for any post that includes 'twitter' in platforms (BYO is enforced).
social.set_twitter_byo('YOUR_X_CONSUMER_KEY', 'YOUR_X_CONSUMER_SECRET')

# Post to Platforms Twitter, Facebook, and LinkedIn
postResult = social.post({'post': 'Nice Posting 2', 'platforms': ['twitter', 'facebook', 'linkedin'], 'profileKey': 'JKSDJI-JKKJKKJ'})
print(postResult)

# Delete (use the top-level Ayrshare post id from postResult['id'])
deleteResult = social.delete({'id': postResult['id']})
print(deleteResult)

# History
print(social.history())
```

### Profile Key

आप POST की बॉडी या GET की क्वेरी में `profileKey` फ़ील्ड के साथ User Profile के लिए Profile Key निर्दिष्ट कर सकते हैं।

### अधिक जानकारी और दस्तावेज़ीकरण

<ul class="custom-bullets">
  <li>[PyPI Package](https://pypi.org/project/social-post-api/)</li>
  <li>[Github Repository](https://github.com/ayrshare/social-post-api-python)</li>
  <li>[Issue Discussion](https://github.com/ayrshare/social-post-api-python/issues)</li>
</ul>
