Skip to content

Commit

Permalink
fixed sell url calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
parruc committed Oct 11, 2017
1 parent 8cd09e1 commit 6949801
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/investhor/scripts/invest_secondary.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ def main():
if __name__ == "__main__":
# execute only if run as a script
main()

4 changes: 0 additions & 4 deletions src/investhor/scripts/sell.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ def sell_items(secondary_api, results, on_sale, discount):
for chunk in chunks:
cancel_req = SecondMarketCancelRequest(to_cancel)
results = secondary_api.second_market_cancel_multiple(cancel_req)
for res in results.payload:
msg = "Cancelling %s" % (get_investment_url(res))
logger.info(msg)
messages.append(msg)
time.sleep(3)

if to_sell:
Expand Down
15 changes: 9 additions & 6 deletions src/investhor/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from datetime import datetime
from datetime import timedelta
from email.message import EmailMessage
from email.mime.text import MIMEText
from email.utils import make_msgid
import json
import logging
import math
Expand All @@ -11,7 +9,6 @@
import sys

from bondora_api import configuration as bondora_configuration
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session

OAUTH_CONFIG_FILE = "oauth2.json"
Expand All @@ -30,9 +27,15 @@ def get_logger():


def get_investment_url(res):
base_url = "https://www.bondora.com/en/investments?search=search&InvestmentSearch.InvestmentNumberOnly="
investment_number = "%d-%d" % (res.auction_number, res.auction_bid_number)
return base_url + investment_number
host = "https://www.bondora.com"
path = "/en/investments"
args = "?search=search&InvestmentSearch.InvestmentNumberOnly=%s"
investment_number = getattr(res, "loan_part_id", None)
if not investment_number:
investment_number = "%d-%d" % (res.auction_number,
res.auction_bid_number)
return host + path + args % investment_number


def send_mail(subject, text):
params = load_config_file(EMAIL_CONFIG_FILE)
Expand Down

0 comments on commit 6949801

Please # to comment.