Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
pip install --upgrade tapi-yandex-market==1.0.3
from tapi_yandex_market import YandexMarket
OAUTH_TOKEN = "{oauth_token}"
OAUTH_CLIENT_ID = "{oauth_client_id}"
client = YandexMarket(
# https://yandex.ru/dev/market/partner/doc/dg/concepts/authorization.html
oauth_token=OAUTH_TOKEN,
oauth_client_id=OAUTH_CLIENT_ID,
# Will retry the request if the request limit is reached.
retry_if_exceeded_requests_limit=True,
)
print(dir(client))
[
'all_feeds_categories',
'all_offers',
'balance',
'bid_recommendations',
'bids',
'bids_settings',
'campaign',
'campaign_invoice',
'campaign_outlets',
'campaigns',
'campaigns_by_login',
'daily_stats',
'delivery_services_dictionary',
'feed',
'feed_categories',
'feed_index_logs',
'feed_parameters',
'feed_refresh',
'feedback_updates',
'feeds',
'geo_region',
'geo_regions',
'hidden_offers',
'invoice',
'invoice_pay_preview',
'logins',
'model',
'model_offers',
'models',
'models_offers',
'monthly_stats',
'offer_prices',
'offers',
'offers_stats',
'outlet',
'outlets',
'outlets_licenses',
'quality_check',
'quality_report',
'quality_ticket',
'quality_ticket_fix',
'quality_tickets',
'region',
'region_children',
'remove_offer_prices',
'settings',
'stats',
'top_market_search',
'update_offer_prices',
'weekly_stats'
]
Detailed resource information
API requests are made using HTTP methods:
DELETE
, GET
, POST
, PUT
.
An example of an HTTP GET
request
from tapi_yandex_market import YandexMarket
client = YandexMarket(...)
result = client.campaigns().get()
# Raw data.
print(result.data)
An example of an HTTP POST
request
Resource documentation
from tapi_yandex_market import YandexMarket
client = YandexMarket(...)
body = {
"parameters":
[
{
"deleted": {boolean},
"name": "{enum}",
"values":
[
{int32},
...
]
},
...
]
}
result = client.feed_parameters(campaignId=..., feedId=...).post(data=body)
# Raw data.
print(result.data)
An example of an HTTP PUT
request
Resource documentation
from tapi_yandex_market import YandexMarket
client = YandexMarket(...)
body = {
"bids":
[
{
"feedId": {int64},
"offerId": "{string}",
"bid": {double},
"dontPullUpBids": {boolean}
},
...
]
}
result = client.bids(campaignId=...).put(data=body)
# Raw data.
print(result.data)
An example of an HTTP DELETE
request
Resource documentation
from tapi_yandex_market import YandexMarket
client = YandexMarket(...)
result = client.outlets_licenses(campaignId=...).delete()
# Raw data.
print(result.data)
Result extraction method.
from tapi_yandex_market import YandexMarket
client = YandexMarket(...)
campaign = client.campaign(campaignId=100500).get()
print(type(campaign))
# <class 'tapi2.tapi.TapiClient'>
print(campaign)
# <class 'tapi2.tapi.TapiClient'>
# <TapiClient object
# { 'campaign': { 'clientId': 992161,
# 'domain': 'lady-xl.ru',
# 'id': 21033612,
# 'state': 1}}>
print(campaign.status_code)
# 200
print(campaign.response)
# <Response [200]>
print(campaign.request_kwargs)
# {'url': 'https://api.partner.market.yandex.ru/v2/campaigns/100500', 'params': {}, 'headers': {'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'OAuth oauth_token="...", oauth_client_id="..."'}, 'data': None}
print(type(campaign.data))
# <class 'dict'>
print(campaign.data)
# {'campaign': {'id': 123456789, 'clientId': 100999, 'domain': 'shop100500', 'state': 1}}
print(type(campaign["campaign"]))
# <class 'dict'>
print(campaign["campaign"])
# {'id': 123456789, 'clientId': 100999, 'domain': 'shop100500', 'state': 1}
Result extraction method.
from tapi_yandex_market import YandexMarket
client = YandexMarket(...)
campaigns = client.campaigns().get()
print(campaigns.data)
# {'pager': {'total': 1, 'from': 1, 'to': 1, 'currentPage': 1, 'pagesCount': 1, 'pageSize': 1}, 'campaigns': [{'id': 21033612, 'clientId': 992161, 'domain': 'lady-xl.ru', 'state': 1}]}
campaigns_list = campaigns().extract()
print(type(campaigns_list))
# <class 'list'>
print(campaigns_list)
# [{'id': 21033612, 'clientId': 992161, 'domain': 'lady-xl.ru', 'state': 1}]
# Or
print(campaigns["campaigns"] == campaigns_list)
# True
# Or
print(campaigns.data["campaigns"] == campaigns["campaigns"] == campaigns_list)
Resource documentation
import datetime as dt
from tapi_yandex_market import YandexMarket
from tapi_yandex_market.helper import iter_flatten_stats_row
client = YandexMarket(...)
campaign_id = 100500
params = dict(
fromDate=dt.date.today() - dt.timedelta(days=3),
toDate=dt.date.today(),
byPlaces=True,
fields="shows,mobile,model"
)
result = client.stats(campaignId=campaign_id).get(params=params)
data = result().extract()
print(data[0])
# {'clicks': 282,
# 'date': '2021-09-03',
# 'detailedStats': [{'clicks': 259,
# 'shows': '1077017',
# 'spending': 33.37,
# 'type': 'mobile'}],
# 'placeGroup': 3,
# 'shows': '1409982',
# 'spending': 36.29}
new_column_names = {"clicksMobile": "clicks_mobile"}
data = list(iter_flatten_stats_row(data, **new_column_names))
print(data[0])
# {'clicks': 282,
# 'clicks_mobile': 259,
# 'date': '2021-09-03',
# 'placeGroup': 3,
# 'shows': '1409982',
# 'showsMobile': '1077017',
# 'spending': 36.29,
# 'spendingMobile': 33.37}
Information about the resource.
client.campaigns().help()
Open resource documentation
client.campaigns().open_docs()
Send a request in the browser.
client.campaigns().open_in_browser()
2021-09-06
2021-09-06
Pavel Maksimov
You can contact me at Телеграм, Facebook
Good luck friend! Put an asterisk;)
Удачи тебе, друг! Поставь звездочку ;)
FAQs
Python client for API Yandex Market
We found that tapi-yandex-market demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.