Author Topic: Did Folio recently change the command to reprice notes?  (Read 4219 times)

Joe6Luck

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Did Folio recently change the command to reprice notes?
« on: May 02, 2014, 03:03:30 AM »
Hi, I use an online Python script to reprice notes. I worked well in the past but showed an error message of "You have not selected any Note(s) to reprice". It seems because the following command doesn't work any more

https://www.lendingclub.com/foliofn/selectNotesToReprice.action?&canceled_loans=12345,23455  (the two numbers are loan_id and order_id).

I tried reading the source code of the html page but am not so advanced to find a solution. Can anyone help?
« Last Edit: May 05, 2014, 05:56:28 PM by Joe6Luck »

core

  • Hero Member
  • *****
  • Posts: 1784
  • Your loss is my gain
    • View Profile
Re: Did Folio recently change the command to reprice notes?
« Reply #1 on: May 02, 2014, 03:31:46 AM »
[EDIT:  Disregard the rest of this post.  I too am seeing some strangeness that wasn't there yesterday.  I'll see what's up and post a second message in a bit with the correct code when I have a chance to look at this]
« Last Edit: May 02, 2014, 06:18:41 AM by core »

core

  • Hero Member
  • *****
  • Posts: 1784
  • Your loss is my gain
    • View Profile
Re: Did Folio recently change the command to reprice notes?
« Reply #2 on: May 02, 2014, 06:40:10 AM »
Ok, I apologize to anyone who wasted any time following the instructions in my last post. 

The corrected reprice notes request is like so:

POST https://www.lendingclub.com/foliofn/repriceSelectedNotes.action
Referer: https://www.lendingclub.com/foliofn/selectNotesToReprice.action
Content-Type: application/x-www-form-urlencoded

post data/payload for two sample notes being repriced at once:
Code: [Select]
expire_date_loan_listing=05/09/2014&json=[{"noteId":"1234","loanId":"1235","orderId":"1237","askingPrice":"5.00"},{"noteId":"2345","loanId":"2346","orderId":"2347","askingPrice":"6.00"}]

You don't need to worry about the struts token on the previous page because it's not used.  Actually there's no need to burn a request on selectNotesToReprice.action at all.

LC made tons of changes yesterday along the same lines.  Several of the Folio functions now requrie a similar json= approach.  So just about any script out there is going to need to be updated by the author unless you want to go through and have to change tons of stuff yourself.
« Last Edit: May 02, 2014, 06:48:22 AM by core »

Fred

  • Hero Member
  • *****
  • Posts: 1421
    • View Profile
Re: Did Folio recently change the command to reprice notes?
« Reply #3 on: May 02, 2014, 10:47:10 AM »
Yep, the note attributes in many of the URLs are now jsonified with"json" key; they used to be simple key-value maps.

core

  • Hero Member
  • *****
  • Posts: 1784
  • Your loss is my gain
    • View Profile
Re: Did Folio recently change the command to reprice notes?
« Reply #4 on: May 02, 2014, 11:49:27 AM »
Yep, the note attributes in many of the URLs are now jsonified with"json" key; they used to be simple key-value maps.

Maybe not maps, since duplicate keys were often used with the old way.  I don't know of an environment where a "map" allows dupes.  Did you have one in mind?  Multimap works.

All I know is... with this new jsuxified approach, there are redundant params included and now it takes 4 times as many bytes to say the same thing as before, after you also factor in the urlencoding of all those other blasted punctuation characters.  All for what?  To do absolutely nothing new.  Brilliant!  Maybe using up more of your upstream was their whole plan.

Joe6Luck

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Did Folio recently change the command to reprice notes?
« Reply #5 on: May 03, 2014, 03:27:20 AM »
Ok, I apologize to anyone who wasted any time following the instructions in my last post. 

The corrected reprice notes request is like so:

POST https://www.lendingclub.com/foliofn/repriceSelectedNotes.action
Referer: https://www.lendingclub.com/foliofn/selectNotesToReprice.action
Content-Type: application/x-www-form-urlencoded

post data/payload for two sample notes being repriced at once:
Code: [Select]
expire_date_loan_listing=05/09/2014&json=[{"noteId":"1234","loanId":"1235","orderId":"1237","askingPrice":"5.00"},{"noteId":"2345","loanId":"2346","orderId":"2347","askingPrice":"6.00"}]

You don't need to worry about the struts token on the previous page because it's not used.  Actually there's no need to burn a request on selectNotesToReprice.action at all.

LC made tons of changes yesterday along the same lines.  Several of the Folio functions now requrie a similar json= approach.  So just about any script out there is going to need to be updated by the author unless you want to go through and have to change tons of stuff yourself.

Hi Core, I followed what you suggested and wrote the following code
Code: [Select]
url = 'https://www.lendingclub.com/foliofn/repriceSelectedNotes.action';
data = 'expire_date_loan_listing=05/09/2014&json=[{"noteId":"1234","loanId":"1235","orderId":"1237","askingPrice":"5.00"}]';
headers = {'content-type': 'application/x-www-form-urlencoded',
                    'referer': 'https://www.lendingclub.com/foliofn/selectNotesToReprice.action'};
response = requests.Session().post(url=url, data=data, headers=headers, allow_redirects=True)

The code runs wells; however, there is no change of price or expiration date on the Folio website. To do a deep dive, I manually opened the content of "response.text" as a html file. It is indeed the same page as the one when we manually click the "Reprice" button on Folio website. However, this file always shows the original price, regardless how I change the "askingPrice" in the code above. Can you help me find what's wrong with the above code?
« Last Edit: May 03, 2014, 03:58:18 AM by Joe6Luck »

core

  • Hero Member
  • *****
  • Posts: 1784
  • Your loss is my gain
    • View Profile
Re: Did Folio recently change the command to reprice notes?
« Reply #6 on: May 03, 2014, 03:57:36 AM »

Hi Core, I followed what you suggested and wrote the following code
Code: [Select]
url = 'https://www.lendingclub.com/foliofn/repriceSelectedNotes.action';
data = 'expire_date_loan_listing=05/09/2014&json=[{"noteId":"1234","loanId":"1235","orderId":"1237","askingPrice":"5.00"}]';
headers = {'content-type': 'application/x-www-form-urlencoded',
                    'referer': 'https://www.lendingclub.com/foliofn/selectNotesToReprice.action'};
response = requests.Session().post(url=url, data=data, headers=headers, allow_redirects=True)

The noteId, loanId, and orderId that I used were just made-up numbers.  You of course have to supply the real ones in your code.

When you say the response.text is the same one as you get when you manually click the reprice button, do you mean it's the form where it asks you for the prices, or the page where it says that the notes have been repriced? And does it show the proper noteId on that page?  I don't see how it possibly could, if you were sending bogus 1234 numbers.

I believe the real problem though is the way you're passing the post data.  I've never written any python code in my life but I believe it needs to look something more like this:

Code: [Select]
data = {'expire_date_loan_listing': '05/09/2014', 'json': '[{"noteId":"1234","loanId":"1235","orderId":"1237","askingPrice":"5.00"}]'};

The way you had it would be fine only if the Requests post() call can handle a single raw string for all the post data.  I don't know if it can.  I suppose that makes sense though... maybe your way is fine.

Either way, look more closely at your response.text.  If you didn't get the note IDs right or got the format wrong, then it's impossible for that response.txt to mention the proper note but just have the wrong price.  Not possible.   If the note it mentions is correct but the price is wrong then there is likely another issue.  Either way I don't think response.txt would give you a rosy success message if it didn't see the proper price data.  Are you sure you're not just seeing the price entry form again in the response? 

You can post snippets of your response.txt if you'd like, after you've tried a few things and still can't figure it out.  My wild guess is that you are just seeing the price entry form because LC didn't see any proper post data.  The page you get back should say "Your offer will remain valid until..." blah blah.  If you're seeing anything else then you're not even getting the right page back.
« Last Edit: May 03, 2014, 04:05:25 AM by core »

Joe6Luck

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Did Folio recently change the command to reprice notes?
« Reply #7 on: May 03, 2014, 06:37:47 PM »



The noteId, loanId, and orderId that I used were just made-up numbers.  You of course have to supply the real ones in your code.



I supplied the real ids when I tested the code on my machine. In fact, I finally found out what's the problem. It seems that I should not quote the askingPrice values. Once this is fixed, everything works well.

Thanks again. Without your code, I couldn't get the repricing function back.

core

  • Hero Member
  • *****
  • Posts: 1784
  • Your loss is my gain
    • View Profile
Re: Did Folio recently change the command to reprice notes?
« Reply #8 on: May 03, 2014, 07:43:55 PM »
Glad you got it working Joe.  About the quotes, believe it or not the real site does use quotes around the numeric price, and I just double-checked right now... quotes still work fine for me.  In your code there may have been a small typo such as leaving out the closing double quote which just happened to be solved by you removing them altogether.

Joe6Luck

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Did Folio recently change the command to reprice notes?
« Reply #9 on: May 04, 2014, 03:17:16 AM »
Although I couldn't test it again, that could be the reason. Anyway, it is working well now. Thanks!