shotcut-python
Advanced tools
+275
-15
| Metadata-Version: 2.2 | ||
| Name: shotcut-python | ||
| Version: 1.0.0 | ||
| Version: 1.0.1 | ||
| Summary: Python client for the Shotcut.in URL shortener API | ||
| Home-page: https://github.com/yourusername/shotcut-python | ||
| Author: Your Name | ||
| Author-email: your.email@example.com | ||
| Home-page: https://github.com/Shotcut-Track/shotcutapi-python | ||
| Author: Shotcut.in | ||
| Author-email: support@shotcut.in | ||
| Classifier: Development Status :: 5 - Production/Stable | ||
@@ -42,4 +42,24 @@ Classifier: Intended Audience :: Developers | ||
| A Python client for the Shotcut.in URL shortener API. This package provides a simple interface to interact with all Shotcut.in API endpoints. | ||
| A comprehensive Python client for the [Shotcut.in](shotcut.in) URL shortener API. This package provides an intuitive interface to interact with all Shotcut.in API endpoints. | ||
| Get Your API Key [Here](https://shotcut.in/developers) | ||
| ## Table of Contents | ||
| - [Installation](#installation) | ||
| - [Features](#features) | ||
| - [Quick Start](#quick-start) | ||
| - [API Reference](#api-reference) | ||
| - [Account Management](#account-management) | ||
| - [URL Shortening](#url-shortening) | ||
| - [QR Codes](#qr-codes) | ||
| - [Campaigns](#campaigns) | ||
| - [Branded Domains](#branded-domains) | ||
| - [Channels](#channels) | ||
| - [Pixels](#pixels) | ||
| - [Custom Splash Pages](#custom-splash-pages) | ||
| - [CTA Overlays](#cta-overlays) | ||
| - [Error Handling](#error-handling) | ||
| - [Development](#development) | ||
| - [License](#license) | ||
| ## Installation | ||
@@ -51,2 +71,15 @@ | ||
| ## Features | ||
| - **URL Shortening**: Create and manage shortened URLs with custom aliases | ||
| - **QR Code Generation**: Create customizable QR codes with logos and colors | ||
| - **Campaign Management**: Organize and track marketing campaigns | ||
| - **Branded Domains**: Set up and manage custom domains | ||
| - **Channels**: Organize content into channels with custom settings | ||
| - **Pixels**: Implement tracking pixels for analytics | ||
| - **Custom Splash Pages**: Create and manage intermediate pages | ||
| - **CTA Overlays**: Add call-to-action overlays to links | ||
| - **Error Handling**: Built-in handling for API errors and rate limits | ||
| - **Type Hints**: Full typing support for better IDE integration | ||
| ## Quick Start | ||
@@ -70,3 +103,5 @@ | ||
| type="link", | ||
| data="https://example.com" | ||
| data="https://example.com", | ||
| background="rgb(255,255,255)", | ||
| foreground="rgb(0,0,0)" | ||
| ) | ||
@@ -76,16 +111,241 @@ print(qr['link']) | ||
| ## Features | ||
| ## API Reference | ||
| - Full support for all Shotcut.in API endpoints | ||
| - Rate limiting handling | ||
| - Error handling | ||
| - Type hints for better IDE support | ||
| - Comprehensive documentation | ||
| ### Account Management | ||
| ## Documentation | ||
| ```python | ||
| # Get account information | ||
| account = api.get_account() | ||
| For full documentation, visit [https://shotcut-python.readthedocs.io](https://shotcut-python.readthedocs.io) | ||
| # Update account details | ||
| api.update_account( | ||
| email="newemail@example.com", | ||
| password="newpassword123" | ||
| ) | ||
| ``` | ||
| ### URL Shortening | ||
| ```python | ||
| # Create a shortened URL | ||
| url = api.shorten_link( | ||
| url="https://example.com", | ||
| custom="my-link", | ||
| password="secret123", | ||
| expiry="2025-12-31", | ||
| domain="custom.com" | ||
| ) | ||
| # List all URLs | ||
| urls = api.list_links( | ||
| limit=20, | ||
| page=1, | ||
| order="clicks" | ||
| ) | ||
| # Get single URL details | ||
| url_details = api.get_link(link_id=123) | ||
| # Update URL | ||
| api.update_link( | ||
| link_id=123, | ||
| url="https://newexample.com", | ||
| password="newpassword123" | ||
| ) | ||
| # Delete URL | ||
| api.delete_link(link_id=123) | ||
| ``` | ||
| ### QR Codes | ||
| ```python | ||
| # Create QR code | ||
| qr = api.create_qr_code( | ||
| type="link", | ||
| data="https://example.com", | ||
| background="rgb(255,255,255)", | ||
| foreground="rgb(0,0,0)", | ||
| logo="https://example.com/logo.png" | ||
| ) | ||
| # List QR codes | ||
| qr_codes = api.list_qr_codes(limit=20, page=1) | ||
| # Get single QR code | ||
| qr_details = api.get_qr_code(qr_id=123) | ||
| # Update QR code | ||
| api.update_qr_code( | ||
| qr_id=123, | ||
| data="https://newexample.com", | ||
| background="rgb(0,0,255)" | ||
| ) | ||
| # Delete QR code | ||
| api.delete_qr_code(qr_id=123) | ||
| ``` | ||
| ### Campaigns | ||
| ```python | ||
| # Create campaign | ||
| campaign = api.create_campaign( | ||
| name="Summer Sale 2025", | ||
| slug="summer-sale", | ||
| public=True | ||
| ) | ||
| # List campaigns | ||
| campaigns = api.list_campaigns(limit=20, page=1) | ||
| # Assign link to campaign | ||
| api.assign_link_to_campaign( | ||
| campaign_id=123, | ||
| link_id=456 | ||
| ) | ||
| # Update campaign | ||
| api.update_campaign( | ||
| campaign_id=123, | ||
| name="Winter Sale 2025", | ||
| public=False | ||
| ) | ||
| # Delete campaign | ||
| api.delete_campaign(campaign_id=123) | ||
| ``` | ||
| ### Branded Domains | ||
| ```python | ||
| # List domains | ||
| domains = api.list_domains(limit=20, page=1) | ||
| # Create domain | ||
| domain = api.create_domain( | ||
| domain="short.example.com", | ||
| redirect_root="https://example.com", | ||
| redirect_404="https://example.com/404" | ||
| ) | ||
| # Update domain | ||
| api.update_domain( | ||
| domain_id=123, | ||
| redirect_root="https://newexample.com" | ||
| ) | ||
| # Delete domain | ||
| api.delete_domain(domain_id=123) | ||
| ``` | ||
| ### Channels | ||
| ```python | ||
| # Create channel | ||
| channel = api.create_channel( | ||
| name="Marketing", | ||
| description="Marketing campaign links", | ||
| color="rgb(255,0,0)", | ||
| starred=True | ||
| ) | ||
| # List channels | ||
| channels = api.list_channels(limit=20, page=1) | ||
| # List channel items | ||
| items = api.list_channel_items( | ||
| channel_id=123, | ||
| limit=20, | ||
| page=1 | ||
| ) | ||
| # Update channel | ||
| api.update_channel( | ||
| channel_id=123, | ||
| name="Sales", | ||
| starred=False | ||
| ) | ||
| # Delete channel | ||
| api.delete_channel(channel_id=123) | ||
| ``` | ||
| ### Pixels | ||
| ```python | ||
| # Create pixel | ||
| pixel = api.create_pixel( | ||
| type="facebook", | ||
| name="FB Conversion Pixel", | ||
| tag="123456789" | ||
| ) | ||
| # List pixels | ||
| pixels = api.list_pixels(limit=20, page=1) | ||
| # Update pixel | ||
| api.update_pixel( | ||
| pixel_id=123, | ||
| name="Updated FB Pixel", | ||
| tag="987654321" | ||
| ) | ||
| # Delete pixel | ||
| api.delete_pixel(pixel_id=123) | ||
| ``` | ||
| ### Custom Splash Pages | ||
| ```python | ||
| # List splash pages | ||
| splash_pages = api.list_splash(limit=20, page=1) | ||
| ``` | ||
| ### CTA Overlays | ||
| ```python | ||
| # List overlays | ||
| overlays = api.list_overlays(limit=20, page=1) | ||
| ``` | ||
| ## Error Handling | ||
| ```python | ||
| from shotcut import ShotcutAPI, ShotcutAPIError | ||
| try: | ||
| api = ShotcutAPI(api_key="your_key") | ||
| response = api.create_link(url="https://example.com") | ||
| except ShotcutAPIError as e: | ||
| print(f"API Error: {str(e)}") | ||
| except RateLimitError as e: | ||
| print(f"Rate limit exceeded. Reset at {e.reset_time}") | ||
| except AuthenticationError as e: | ||
| print("Invalid API key") | ||
| except ValidationError as e: | ||
| print(f"Invalid data: {str(e)}") | ||
| ``` | ||
| ## Development | ||
| To contribute to this project: | ||
| 1. Clone the repository | ||
| ```bash | ||
| git clone https://github.com/Shotcut-Track/shotcutapi-python.git | ||
| ``` | ||
| 2. Install development dependencies | ||
| ```bash | ||
| pip install -e ".[dev]" | ||
| ``` | ||
| 3. Run tests | ||
| ```bash | ||
| pytest | ||
| ``` | ||
| ## License | ||
| MIT License - see LICENSE file for details | ||
| MIT License - see [LICENSE](https://github.com/Shotcut-Track/shotcutapi-python/blob/main/LICENSE) file for details. |
+271
-11
| # Shotcut Python API Client | ||
| A Python client for the Shotcut.in URL shortener API. This package provides a simple interface to interact with all Shotcut.in API endpoints. | ||
| A comprehensive Python client for the [Shotcut.in](shotcut.in) URL shortener API. This package provides an intuitive interface to interact with all Shotcut.in API endpoints. | ||
| Get Your API Key [Here](https://shotcut.in/developers) | ||
| ## Table of Contents | ||
| - [Installation](#installation) | ||
| - [Features](#features) | ||
| - [Quick Start](#quick-start) | ||
| - [API Reference](#api-reference) | ||
| - [Account Management](#account-management) | ||
| - [URL Shortening](#url-shortening) | ||
| - [QR Codes](#qr-codes) | ||
| - [Campaigns](#campaigns) | ||
| - [Branded Domains](#branded-domains) | ||
| - [Channels](#channels) | ||
| - [Pixels](#pixels) | ||
| - [Custom Splash Pages](#custom-splash-pages) | ||
| - [CTA Overlays](#cta-overlays) | ||
| - [Error Handling](#error-handling) | ||
| - [Development](#development) | ||
| - [License](#license) | ||
| ## Installation | ||
@@ -11,2 +31,15 @@ | ||
| ## Features | ||
| - **URL Shortening**: Create and manage shortened URLs with custom aliases | ||
| - **QR Code Generation**: Create customizable QR codes with logos and colors | ||
| - **Campaign Management**: Organize and track marketing campaigns | ||
| - **Branded Domains**: Set up and manage custom domains | ||
| - **Channels**: Organize content into channels with custom settings | ||
| - **Pixels**: Implement tracking pixels for analytics | ||
| - **Custom Splash Pages**: Create and manage intermediate pages | ||
| - **CTA Overlays**: Add call-to-action overlays to links | ||
| - **Error Handling**: Built-in handling for API errors and rate limits | ||
| - **Type Hints**: Full typing support for better IDE integration | ||
| ## Quick Start | ||
@@ -30,3 +63,5 @@ | ||
| type="link", | ||
| data="https://example.com" | ||
| data="https://example.com", | ||
| background="rgb(255,255,255)", | ||
| foreground="rgb(0,0,0)" | ||
| ) | ||
@@ -36,16 +71,241 @@ print(qr['link']) | ||
| ## Features | ||
| ## API Reference | ||
| - Full support for all Shotcut.in API endpoints | ||
| - Rate limiting handling | ||
| - Error handling | ||
| - Type hints for better IDE support | ||
| - Comprehensive documentation | ||
| ### Account Management | ||
| ## Documentation | ||
| ```python | ||
| # Get account information | ||
| account = api.get_account() | ||
| For full documentation, visit [https://shotcut-python.readthedocs.io](https://shotcut-python.readthedocs.io) | ||
| # Update account details | ||
| api.update_account( | ||
| email="newemail@example.com", | ||
| password="newpassword123" | ||
| ) | ||
| ``` | ||
| ### URL Shortening | ||
| ```python | ||
| # Create a shortened URL | ||
| url = api.shorten_link( | ||
| url="https://example.com", | ||
| custom="my-link", | ||
| password="secret123", | ||
| expiry="2025-12-31", | ||
| domain="custom.com" | ||
| ) | ||
| # List all URLs | ||
| urls = api.list_links( | ||
| limit=20, | ||
| page=1, | ||
| order="clicks" | ||
| ) | ||
| # Get single URL details | ||
| url_details = api.get_link(link_id=123) | ||
| # Update URL | ||
| api.update_link( | ||
| link_id=123, | ||
| url="https://newexample.com", | ||
| password="newpassword123" | ||
| ) | ||
| # Delete URL | ||
| api.delete_link(link_id=123) | ||
| ``` | ||
| ### QR Codes | ||
| ```python | ||
| # Create QR code | ||
| qr = api.create_qr_code( | ||
| type="link", | ||
| data="https://example.com", | ||
| background="rgb(255,255,255)", | ||
| foreground="rgb(0,0,0)", | ||
| logo="https://example.com/logo.png" | ||
| ) | ||
| # List QR codes | ||
| qr_codes = api.list_qr_codes(limit=20, page=1) | ||
| # Get single QR code | ||
| qr_details = api.get_qr_code(qr_id=123) | ||
| # Update QR code | ||
| api.update_qr_code( | ||
| qr_id=123, | ||
| data="https://newexample.com", | ||
| background="rgb(0,0,255)" | ||
| ) | ||
| # Delete QR code | ||
| api.delete_qr_code(qr_id=123) | ||
| ``` | ||
| ### Campaigns | ||
| ```python | ||
| # Create campaign | ||
| campaign = api.create_campaign( | ||
| name="Summer Sale 2025", | ||
| slug="summer-sale", | ||
| public=True | ||
| ) | ||
| # List campaigns | ||
| campaigns = api.list_campaigns(limit=20, page=1) | ||
| # Assign link to campaign | ||
| api.assign_link_to_campaign( | ||
| campaign_id=123, | ||
| link_id=456 | ||
| ) | ||
| # Update campaign | ||
| api.update_campaign( | ||
| campaign_id=123, | ||
| name="Winter Sale 2025", | ||
| public=False | ||
| ) | ||
| # Delete campaign | ||
| api.delete_campaign(campaign_id=123) | ||
| ``` | ||
| ### Branded Domains | ||
| ```python | ||
| # List domains | ||
| domains = api.list_domains(limit=20, page=1) | ||
| # Create domain | ||
| domain = api.create_domain( | ||
| domain="short.example.com", | ||
| redirect_root="https://example.com", | ||
| redirect_404="https://example.com/404" | ||
| ) | ||
| # Update domain | ||
| api.update_domain( | ||
| domain_id=123, | ||
| redirect_root="https://newexample.com" | ||
| ) | ||
| # Delete domain | ||
| api.delete_domain(domain_id=123) | ||
| ``` | ||
| ### Channels | ||
| ```python | ||
| # Create channel | ||
| channel = api.create_channel( | ||
| name="Marketing", | ||
| description="Marketing campaign links", | ||
| color="rgb(255,0,0)", | ||
| starred=True | ||
| ) | ||
| # List channels | ||
| channels = api.list_channels(limit=20, page=1) | ||
| # List channel items | ||
| items = api.list_channel_items( | ||
| channel_id=123, | ||
| limit=20, | ||
| page=1 | ||
| ) | ||
| # Update channel | ||
| api.update_channel( | ||
| channel_id=123, | ||
| name="Sales", | ||
| starred=False | ||
| ) | ||
| # Delete channel | ||
| api.delete_channel(channel_id=123) | ||
| ``` | ||
| ### Pixels | ||
| ```python | ||
| # Create pixel | ||
| pixel = api.create_pixel( | ||
| type="facebook", | ||
| name="FB Conversion Pixel", | ||
| tag="123456789" | ||
| ) | ||
| # List pixels | ||
| pixels = api.list_pixels(limit=20, page=1) | ||
| # Update pixel | ||
| api.update_pixel( | ||
| pixel_id=123, | ||
| name="Updated FB Pixel", | ||
| tag="987654321" | ||
| ) | ||
| # Delete pixel | ||
| api.delete_pixel(pixel_id=123) | ||
| ``` | ||
| ### Custom Splash Pages | ||
| ```python | ||
| # List splash pages | ||
| splash_pages = api.list_splash(limit=20, page=1) | ||
| ``` | ||
| ### CTA Overlays | ||
| ```python | ||
| # List overlays | ||
| overlays = api.list_overlays(limit=20, page=1) | ||
| ``` | ||
| ## Error Handling | ||
| ```python | ||
| from shotcut import ShotcutAPI, ShotcutAPIError | ||
| try: | ||
| api = ShotcutAPI(api_key="your_key") | ||
| response = api.create_link(url="https://example.com") | ||
| except ShotcutAPIError as e: | ||
| print(f"API Error: {str(e)}") | ||
| except RateLimitError as e: | ||
| print(f"Rate limit exceeded. Reset at {e.reset_time}") | ||
| except AuthenticationError as e: | ||
| print("Invalid API key") | ||
| except ValidationError as e: | ||
| print(f"Invalid data: {str(e)}") | ||
| ``` | ||
| ## Development | ||
| To contribute to this project: | ||
| 1. Clone the repository | ||
| ```bash | ||
| git clone https://github.com/Shotcut-Track/shotcutapi-python.git | ||
| ``` | ||
| 2. Install development dependencies | ||
| ```bash | ||
| pip install -e ".[dev]" | ||
| ``` | ||
| 3. Run tests | ||
| ```bash | ||
| pytest | ||
| ``` | ||
| ## License | ||
| MIT License - see LICENSE file for details | ||
| MIT License - see [LICENSE](https://github.com/Shotcut-Track/shotcutapi-python/blob/main/LICENSE) file for details. |
+4
-4
@@ -8,9 +8,9 @@ from setuptools import setup, find_packages | ||
| name="shotcut-python", | ||
| version="1.0.0", | ||
| author="Your Name", | ||
| author_email="your.email@example.com", | ||
| version="1.0.1", | ||
| author="Shotcut.in", | ||
| author_email="support@shotcut.in", | ||
| description="Python client for the Shotcut.in URL shortener API", | ||
| long_description=long_description, | ||
| long_description_content_type="text/markdown", | ||
| url="https://github.com/yourusername/shotcut-python", | ||
| url="https://github.com/Shotcut-Track/shotcutapi-python", | ||
| packages=find_packages(), | ||
@@ -17,0 +17,0 @@ classifiers=[ |
| Metadata-Version: 2.2 | ||
| Name: shotcut-python | ||
| Version: 1.0.0 | ||
| Version: 1.0.1 | ||
| Summary: Python client for the Shotcut.in URL shortener API | ||
| Home-page: https://github.com/yourusername/shotcut-python | ||
| Author: Your Name | ||
| Author-email: your.email@example.com | ||
| Home-page: https://github.com/Shotcut-Track/shotcutapi-python | ||
| Author: Shotcut.in | ||
| Author-email: support@shotcut.in | ||
| Classifier: Development Status :: 5 - Production/Stable | ||
@@ -42,4 +42,24 @@ Classifier: Intended Audience :: Developers | ||
| A Python client for the Shotcut.in URL shortener API. This package provides a simple interface to interact with all Shotcut.in API endpoints. | ||
| A comprehensive Python client for the [Shotcut.in](shotcut.in) URL shortener API. This package provides an intuitive interface to interact with all Shotcut.in API endpoints. | ||
| Get Your API Key [Here](https://shotcut.in/developers) | ||
| ## Table of Contents | ||
| - [Installation](#installation) | ||
| - [Features](#features) | ||
| - [Quick Start](#quick-start) | ||
| - [API Reference](#api-reference) | ||
| - [Account Management](#account-management) | ||
| - [URL Shortening](#url-shortening) | ||
| - [QR Codes](#qr-codes) | ||
| - [Campaigns](#campaigns) | ||
| - [Branded Domains](#branded-domains) | ||
| - [Channels](#channels) | ||
| - [Pixels](#pixels) | ||
| - [Custom Splash Pages](#custom-splash-pages) | ||
| - [CTA Overlays](#cta-overlays) | ||
| - [Error Handling](#error-handling) | ||
| - [Development](#development) | ||
| - [License](#license) | ||
| ## Installation | ||
@@ -51,2 +71,15 @@ | ||
| ## Features | ||
| - **URL Shortening**: Create and manage shortened URLs with custom aliases | ||
| - **QR Code Generation**: Create customizable QR codes with logos and colors | ||
| - **Campaign Management**: Organize and track marketing campaigns | ||
| - **Branded Domains**: Set up and manage custom domains | ||
| - **Channels**: Organize content into channels with custom settings | ||
| - **Pixels**: Implement tracking pixels for analytics | ||
| - **Custom Splash Pages**: Create and manage intermediate pages | ||
| - **CTA Overlays**: Add call-to-action overlays to links | ||
| - **Error Handling**: Built-in handling for API errors and rate limits | ||
| - **Type Hints**: Full typing support for better IDE integration | ||
| ## Quick Start | ||
@@ -70,3 +103,5 @@ | ||
| type="link", | ||
| data="https://example.com" | ||
| data="https://example.com", | ||
| background="rgb(255,255,255)", | ||
| foreground="rgb(0,0,0)" | ||
| ) | ||
@@ -76,16 +111,241 @@ print(qr['link']) | ||
| ## Features | ||
| ## API Reference | ||
| - Full support for all Shotcut.in API endpoints | ||
| - Rate limiting handling | ||
| - Error handling | ||
| - Type hints for better IDE support | ||
| - Comprehensive documentation | ||
| ### Account Management | ||
| ## Documentation | ||
| ```python | ||
| # Get account information | ||
| account = api.get_account() | ||
| For full documentation, visit [https://shotcut-python.readthedocs.io](https://shotcut-python.readthedocs.io) | ||
| # Update account details | ||
| api.update_account( | ||
| email="newemail@example.com", | ||
| password="newpassword123" | ||
| ) | ||
| ``` | ||
| ### URL Shortening | ||
| ```python | ||
| # Create a shortened URL | ||
| url = api.shorten_link( | ||
| url="https://example.com", | ||
| custom="my-link", | ||
| password="secret123", | ||
| expiry="2025-12-31", | ||
| domain="custom.com" | ||
| ) | ||
| # List all URLs | ||
| urls = api.list_links( | ||
| limit=20, | ||
| page=1, | ||
| order="clicks" | ||
| ) | ||
| # Get single URL details | ||
| url_details = api.get_link(link_id=123) | ||
| # Update URL | ||
| api.update_link( | ||
| link_id=123, | ||
| url="https://newexample.com", | ||
| password="newpassword123" | ||
| ) | ||
| # Delete URL | ||
| api.delete_link(link_id=123) | ||
| ``` | ||
| ### QR Codes | ||
| ```python | ||
| # Create QR code | ||
| qr = api.create_qr_code( | ||
| type="link", | ||
| data="https://example.com", | ||
| background="rgb(255,255,255)", | ||
| foreground="rgb(0,0,0)", | ||
| logo="https://example.com/logo.png" | ||
| ) | ||
| # List QR codes | ||
| qr_codes = api.list_qr_codes(limit=20, page=1) | ||
| # Get single QR code | ||
| qr_details = api.get_qr_code(qr_id=123) | ||
| # Update QR code | ||
| api.update_qr_code( | ||
| qr_id=123, | ||
| data="https://newexample.com", | ||
| background="rgb(0,0,255)" | ||
| ) | ||
| # Delete QR code | ||
| api.delete_qr_code(qr_id=123) | ||
| ``` | ||
| ### Campaigns | ||
| ```python | ||
| # Create campaign | ||
| campaign = api.create_campaign( | ||
| name="Summer Sale 2025", | ||
| slug="summer-sale", | ||
| public=True | ||
| ) | ||
| # List campaigns | ||
| campaigns = api.list_campaigns(limit=20, page=1) | ||
| # Assign link to campaign | ||
| api.assign_link_to_campaign( | ||
| campaign_id=123, | ||
| link_id=456 | ||
| ) | ||
| # Update campaign | ||
| api.update_campaign( | ||
| campaign_id=123, | ||
| name="Winter Sale 2025", | ||
| public=False | ||
| ) | ||
| # Delete campaign | ||
| api.delete_campaign(campaign_id=123) | ||
| ``` | ||
| ### Branded Domains | ||
| ```python | ||
| # List domains | ||
| domains = api.list_domains(limit=20, page=1) | ||
| # Create domain | ||
| domain = api.create_domain( | ||
| domain="short.example.com", | ||
| redirect_root="https://example.com", | ||
| redirect_404="https://example.com/404" | ||
| ) | ||
| # Update domain | ||
| api.update_domain( | ||
| domain_id=123, | ||
| redirect_root="https://newexample.com" | ||
| ) | ||
| # Delete domain | ||
| api.delete_domain(domain_id=123) | ||
| ``` | ||
| ### Channels | ||
| ```python | ||
| # Create channel | ||
| channel = api.create_channel( | ||
| name="Marketing", | ||
| description="Marketing campaign links", | ||
| color="rgb(255,0,0)", | ||
| starred=True | ||
| ) | ||
| # List channels | ||
| channels = api.list_channels(limit=20, page=1) | ||
| # List channel items | ||
| items = api.list_channel_items( | ||
| channel_id=123, | ||
| limit=20, | ||
| page=1 | ||
| ) | ||
| # Update channel | ||
| api.update_channel( | ||
| channel_id=123, | ||
| name="Sales", | ||
| starred=False | ||
| ) | ||
| # Delete channel | ||
| api.delete_channel(channel_id=123) | ||
| ``` | ||
| ### Pixels | ||
| ```python | ||
| # Create pixel | ||
| pixel = api.create_pixel( | ||
| type="facebook", | ||
| name="FB Conversion Pixel", | ||
| tag="123456789" | ||
| ) | ||
| # List pixels | ||
| pixels = api.list_pixels(limit=20, page=1) | ||
| # Update pixel | ||
| api.update_pixel( | ||
| pixel_id=123, | ||
| name="Updated FB Pixel", | ||
| tag="987654321" | ||
| ) | ||
| # Delete pixel | ||
| api.delete_pixel(pixel_id=123) | ||
| ``` | ||
| ### Custom Splash Pages | ||
| ```python | ||
| # List splash pages | ||
| splash_pages = api.list_splash(limit=20, page=1) | ||
| ``` | ||
| ### CTA Overlays | ||
| ```python | ||
| # List overlays | ||
| overlays = api.list_overlays(limit=20, page=1) | ||
| ``` | ||
| ## Error Handling | ||
| ```python | ||
| from shotcut import ShotcutAPI, ShotcutAPIError | ||
| try: | ||
| api = ShotcutAPI(api_key="your_key") | ||
| response = api.create_link(url="https://example.com") | ||
| except ShotcutAPIError as e: | ||
| print(f"API Error: {str(e)}") | ||
| except RateLimitError as e: | ||
| print(f"Rate limit exceeded. Reset at {e.reset_time}") | ||
| except AuthenticationError as e: | ||
| print("Invalid API key") | ||
| except ValidationError as e: | ||
| print(f"Invalid data: {str(e)}") | ||
| ``` | ||
| ## Development | ||
| To contribute to this project: | ||
| 1. Clone the repository | ||
| ```bash | ||
| git clone https://github.com/Shotcut-Track/shotcutapi-python.git | ||
| ``` | ||
| 2. Install development dependencies | ||
| ```bash | ||
| pip install -e ".[dev]" | ||
| ``` | ||
| 3. Run tests | ||
| ```bash | ||
| pytest | ||
| ``` | ||
| ## License | ||
| MIT License - see LICENSE file for details | ||
| MIT License - see [LICENSE](https://github.com/Shotcut-Track/shotcutapi-python/blob/main/LICENSE) file for details. |
@@ -15,3 +15,2 @@ LICENSE | ||
| shotcut_python.egg-info/requires.txt | ||
| shotcut_python.egg-info/top_level.txt | ||
| tests/test_api.py | ||
| shotcut_python.egg-info/top_level.txt |
| import pytest | ||
| from shotcut import ShotcutAPI, ShotcutAPIError | ||
| from unittest.mock import patch, Mock | ||
| @pytest.fixture | ||
| def api(): | ||
| return ShotcutAPI(api_key="7901c0be871cecfe075fb85f0bb01c38") | ||
| def test_shorten_link(api): | ||
| with patch('requests.request') as mock_request: | ||
| mock_request.return_value.json.return_value = { | ||
| "error": 0, | ||
| "id": 1, | ||
| "shorturl": "https://shotcut.in/test" | ||
| } | ||
| response = api.shorten_link(url="https://example.com") | ||
| assert response["shorturl"] == "https://shotcut.in/test" | ||
| def test_invalid_api_key(): | ||
| with patch('requests.request') as mock_request: | ||
| mock_request.return_value.json.return_value = { | ||
| "error": 1, | ||
| "message": "Invalid API key" | ||
| } | ||
| api = ShotcutAPI(api_key="invalid_key") | ||
| with pytest.raises(ShotcutAPIError) as exc_info: | ||
| api.get_account() | ||
| # Verify the exact error message | ||
| assert str(exc_info.value) == "Invalid API key" |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
41792
55.33%17
-5.56%455
-5.21%