Fix dist function

master
Mark Veidemanis 3 years ago
parent eaa4528634
commit f6a67abd4f
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -29,8 +29,12 @@ def handle_exceptions(func):
if "success" in rtrn:
if "message" in rtrn:
if not rtrn["success"] and rtrn["message"] == "API ERROR":
log.error("API error: {code}", code=rtrn["response"]["error"]["error_code"])
return False
if "error_code" in rtrn["response"]["error"]:
log.error("API error: {code}", code=rtrn["response"]["error"]["error_code"])
return False
else:
log.error("API error: {code}", code=rtrn["response"]["error"])
return False
return rtrn
return inner_function
@ -437,6 +441,12 @@ class Agora(object):
public_ad_dict_xmr = {}
public_ad_dict_btc = {}
rates_crypto = self.cg.get_price(ids=["monero", "bitcoin"], vs_currencies=currencies)
# NOTES:
# Get all ads for each currency, with all the payment methods.
# Create a function to, in turn, filter these so it contains only one payment method. Run autoprice on this.
# Append all results to to_update. Repeat for remaining payment methods, then call slow update.
for currency in currencies:
try:
rates_xmr = rates_crypto["monero"][currency]
@ -665,7 +675,7 @@ class Agora(object):
return (min_local, max_local)
@handle_exceptions
def create_ad(self, asset, countrycode, currency, provider, edit=True, ad_id=None):
def create_ad(self, asset, countrycode, currency, provider, edit=False, ad_id=None):
"""
Post an ad with the given asset in a country with a given currency.
Convert the min and max amounts from settings to the given currency with CurrencyRates.

Loading…
Cancel
Save