Last active
September 19, 2023 19:07
-
-
Save y4kupkaya/9d64a38d56201df4b2556ecd47f93ea5 to your computer and use it in GitHub Desktop.
Example API Usage for medyamiz.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
class Api: | |
def __init__(self): | |
# API URL | |
self.api_url = 'https://medyamiz.com/api/v2' | |
# API Anahtarınız (Your API Key) | |
self.api_key = '' | |
# Sipariş ekle (Add Order) | |
def order(self, data): | |
post_data = {**{'key': self.api_key, 'action': 'add'}, **data} | |
response = self.connect(post_data) | |
return json.loads(response) | |
# Sipariş Durumu Al (Get Order Status) | |
def status(self, order_id): | |
post_data = {'key': self.api_key, 'action': 'status', 'order': order_id} | |
response = self.connect(post_data) | |
return json.loads(response) | |
# Siparişlerin Durumunu Alın (Get Multiple Order Status) | |
def multiStatus(self, order_ids): | |
post_data = {'key': self.api_key, 'action': 'status', 'orders': ','.join(map(str, order_ids))} | |
response = self.connect(post_data) | |
return json.loads(response) | |
# Servisleri Getir (Get Services) | |
def services(self): | |
post_data = {'key': self.api_key, 'action': 'services'} | |
response = self.connect(post_data) | |
return json.loads(response) | |
# Siparişi Doldur (Refill Order) | |
def refill(self, order_id): | |
post_data = {'key': self.api_key, 'order': order_id} | |
response = self.connect(post_data) | |
return json.loads(response) | |
# Siparişleri doldur (Refill Multiple Orders) | |
def multiRefill(self, order_ids): | |
post_data = {'key': self.api_key, 'orders': ','.join(map(str, order_ids))} | |
response = self.connect(post_data) | |
return json.loads(response) | |
# Doldurma Durumunu Alın (Get Refill Status) | |
def refillStatus(self, refill_id): | |
post_data = {'key': self.api_key, 'refill': refill_id} | |
response = self.connect(post_data) | |
return json.loads(response) | |
# Doldurma Durumlarını Alın (Get Multiple Refill Status) | |
def multiRefillStatus(self, refill_ids): | |
post_data = {'key': self.api_key, 'refills': ','.join(map(str, refill_ids))} | |
response = self.connect(post_data) | |
return json.loads(response) | |
# Bakiyeyi Al (Get Balance) | |
def balance(self): | |
post_data = {'key': self.api_key, 'action': 'balance'} | |
response = self.connect(post_data) | |
return json.loads(response) | |
def connect(self, post_data): | |
response = requests.post(self.api_url, data=post_data) | |
if response.status_code == 200: | |
return response.text | |
else: | |
return json.dumps({'error': 'Failed to connect to the API'}) | |
# Examples | |
api = Api() | |
services = api.services() # Return all services | |
balance = api.balance() # Return user balance | |
# Add order | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'quantity': 100, 'runs': 2, 'interval': 5}) # Default | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'comments': "good pic\ngreat photo\n:)\n;"}) # Custom Comments | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'quantity': 100, 'usernames': "test, testing", 'hashtags': "#goodphoto"}) # Mentions with Hashtags | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'usernames': "test\nexample\nfb"}) # Mentions Custom List | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'quantity': 100, 'hashtag': "test"}) # Mentions Hashtag | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'quantity': 1000, 'username': "test"}) # Mentions User Followers | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'quantity': 1000, 'media': "http://medyamiz.com/p/Ds2kfEr24Dr"}) # Mentions Media Likers | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test'}) # Package | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'quantity': 100, 'runs': 10, 'interval': 60}) # Drip-feed | |
# Yalnızca eski gönderiler (Only old posts) | |
order = api.order({'service': 1, 'username': 'username', 'min': 100, 'max': 110, 'posts': 0, 'delay': 30, 'expiry': '11/11/2022'}) # Subscriptions | |
# Sınırsız yeni gönderiler ve 5 eski gönderi (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'}) # Subscriptions | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'quantity': 100, 'username': "test"}) # Comment Likes | |
order = api.order({'service': 1, 'link': 'http://medyamiz.com/test', 'quantity': 100, 'answer_number': '7'}) # Poll | |
status = api.status(order['order']) # Return status, charge, remains, start count, currency | |
statuses = api.multiStatus([1, 2, 3]) # Return orders status, charge, remains, start count, currency | |
refill = api.multiRefill([1, 2]) | |
refillIds = [item['refill'] for item in refill] | |
if refillIds: | |
refillStatuses = api.multiRefillStatus(refillIds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment