""" Orbitexa SMM Panel API - Python Client Full API integration example """ import requests import json from typing import List, Dict, Union, Optional class Api: """Orbitexa SMM Panel API Client""" def __init__(self, api_key: str = ''): self.api_url = 'https://new.orbitexa.com/api/v2' self.api_key = api_key def _connect(self, post_data: Dict) -> Optional[str]: """Send request to API""" if not isinstance(post_data, dict): return None # Add API key to all requests post_data['key'] = self.api_key try: response = requests.post( self.api_url, data=post_data, headers={ 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)' }, timeout=30, verify=False ) return response.text except requests.RequestException: return None def order(self, data: Dict) -> Dict: """Add new order Args: data: Dictionary with order parameters - service: Service ID (required) - link: Link to page (required) - quantity: Needed quantity (required) - runs: Runs to deliver (optional) - interval: Interval in minutes (optional) Returns: dict: Response with order ID Example: # Default order order = api.order({'service': 1, 'link': 'http://example.com/test', 'quantity': 100}) # With runs and interval order = api.order({'service': 1, 'link': 'http://example.com/test', 'quantity': 100, 'runs': 2, 'interval': 5}) # Package order = api.order({'service': 1, 'link': 'http://example.com/test'}) # Subscriptions - old posts only order = api.order({'service': 1, 'username': 'username', 'min': 100, 'max': 110, 'posts': 0, 'delay': 30, 'expiry': '11/11/2022'}) # Subscriptions - unlimited new posts and 5 old posts order = api.order({'service': 1, 'username': 'username', 'min': 100, 'max': 110, 'old_posts': 5, 'delay': 30, 'expiry': '11/11/2022'}) # Poll order = api.order({'service': 1, 'link': 'http://example.com/test', 'quantity': 100, 'answer_number': '7'}) """ data['action'] = 'add' result = self._connect(data) return json.loads(result) if result else {} def status(self, order_id: int) -> Dict: """Get order status Args: order_id: Order ID Returns: dict: Response with status, charge, remains, start count, currency """ result = self._connect({ 'action': 'status', 'order': order_id }) return json.loads(result) if result else {} def multi_status(self, order_ids: List[int]) -> Dict: """Get multiple orders status Args: order_ids: List of order IDs Returns: dict: Response with statuses for each order """ result = self._connect({ 'action': 'status', 'orders': ','.join(str(oid) for oid in order_ids) }) return json.loads(result) if result else {} def services(self) -> List[Dict]: """Get all available services Returns: list: List of services with details """ result = self._connect({'action': 'services'}) return json.loads(result) if result else [] def refill(self, order_id: int) -> Dict: """Create refill for order Args: order_id: Order ID Returns: dict: Response with refill ID """ result = self._connect({ 'action': 'refill', 'order': order_id }) return json.loads(result) if result else {} def multi_refill(self, order_ids: List[int]) -> List[Dict]: """Create refills for multiple orders Args: order_ids: List of order IDs Returns: list: List of refill responses """ result = self._connect({ 'action': 'refill', 'orders': ','.join(str(oid) for oid in order_ids) }) return json.loads(result) if result else [] def refill_status(self, refill_id: int) -> Dict: """Get refill status Args: refill_id: Refill ID Returns: dict: Response with refill status """ result = self._connect({ 'action': 'refill_status', 'refill': refill_id }) return json.loads(result) if result else {} def multi_refill_status(self, refill_ids: List[int]) -> List[Dict]: """Get multiple refills status Args: refill_ids: List of refill IDs Returns: list: List of refill statuses """ result = self._connect({ 'action': 'refill_status', 'refills': ','.join(str(rid) for rid in refill_ids) }) return json.loads(result) if result else [] def cancel(self, order_ids: List[int]) -> List[Dict]: """Cancel orders Args: order_ids: List of order IDs to cancel Returns: list: List of cancel responses """ result = self._connect({ 'action': 'cancel', 'orders': ','.join(str(oid) for oid in order_ids) }) return json.loads(result) if result else [] def balance(self) -> Dict: """Get user balance Returns: dict: Response with balance and currency """ result = self._connect({'action': 'balance'}) return json.loads(result) if result else {} # ============================================================ # Examples # ============================================================ if __name__ == '__main__': # Initialize API with your key api = Api(api_key='YOUR_API_KEY_HERE') # Get all services services = api.services() print(f"Services: {len(services)} available") # Get balance balance = api.balance() print(f"Balance: {balance.get('balance', 'N/A')} {balance.get('currency', 'USD')}") # Add order - Default order = api.order({ 'service': 1, 'link': 'http://example.com/test', 'quantity': 100 }) print(f"Order created: {order.get('order', 'N/A')}") # Add order - With runs and interval order = api.order({ 'service': 1, 'link': 'http://example.com/test', 'quantity': 100, 'runs': 2, 'interval': 5 }) # Add order - Package order = api.order({ 'service': 1, 'link': 'http://example.com/test' }) # Add order - Subscriptions (old posts only) order = api.order({ 'service': 1, 'username': 'username', 'min': 100, 'max': 110, 'posts': 0, 'delay': 30, 'expiry': '11/11/2022' }) # Add order - Subscriptions (unlimited new + 5 old posts) order = api.order({ 'service': 1, 'username': 'username', 'min': 100, 'max': 110, 'old_posts': 5, 'delay': 30, 'expiry': '11/11/2022' }) # Add order - Poll order = api.order({ 'service': 1, 'link': 'http://example.com/test', 'quantity': 100, 'answer_number': '7' }) # Get order status if order.get('order'): status = api.status(order['order']) print(f"Order status: {status.get('status', 'N/A')}") print(f"Remains: {status.get('remains', 'N/A')}") print(f"Charge: {status.get('charge', 'N/A')} {status.get('currency', 'USD')}") # Get multiple orders status statuses = api.multi_status([1, 2, 3]) for oid, data in statuses.items(): print(f"Order {oid}: {data.get('status', 'N/A')}") # Create refill if order.get('order'): refill = api.refill(order['order']) print(f"Refill created: {refill.get('refill', 'N/A')}") # Create multiple refills refills = api.multi_refill([1, 2]) refill_ids = [r.get('refill') for r in refills if r.get('refill')] print(f"Refills created: {refill_ids}") # Get refill statuses if refill_ids: refill_statuses = api.multi_refill_status(refill_ids) for rs in refill_statuses: print(f"Refill {rs.get('refill', 'N/A')}: {rs.get('status', 'N/A')}") # Cancel orders cancel_result = api.cancel([1, 2]) print(f"Cancel result: {cancel_result}")