SergioGonzalezSanz / customer-analytics-pydata-workshop-march-2018

Repo containing info and exercises about the customer analytics / pydata workshop in March 2018
6 stars 4 forks source link

Submission code snippet #3

Open b3by opened 6 years ago

b3by commented 6 years ago

Here is the code snippet to send a submission to the leaderboard server. It can be integrated in the notebook, so no hassle for saving the produced labels and uploading them using the website. The snippet uses requests, so we should probably mention that they need to have this installed if they want to submit from within the notebook.

import requests

session = requests.Session()

url = 'https://wsleaderboard.herokuapp.com/'
content = {'username': 'yolo', 'password': 'yolo'}
headers = {'Content-type': 'application/JSON'}

r = session.post(url + 'login', json=content, headers=headers)

fakeSub = '10' * int(10367 / 2) + '1'
sub = {'labels': fakeSub}

res = session.post(url + 'submission', json=sub)

print(res.text)

Should I put the script somewhere?

SergioGonzalezSanz commented 6 years ago

Thanks @b3by !! I've added the code to a cell in Task 2. I'll also add the requests dependency to the README.md.