Hey all,
I've setup Python and installed the 1.8.3 Betfairlightweight
I have then tried running the
However it is coming up with this output
I have tried things like changing the backslash to a forward slash but no luck. I was able to connect using the some sample code from the betfairlightweight github via the interactive login option but im guessing thats not really what I want to be using long term.
Any ideas on what im doing wrong on this one?
Cheers
Rob
I've setup Python and installed the 1.8.3 Betfairlightweight
I have then tried running the
Code:
# Import libraries import betfairlightweight from betfairlightweight import filters import pandas as pd import numpy as np import os import datetime import json # Change this certs path to wherever you're storing your certificates certs_path = r'C:\Users\wardj\Desktop\certs' # Change these login details to your own my_username = "your_username" my_password = "your_password" my_app_key = "your_app_key" trading = betfairlightweight.APIClient(username=my_username, password=my_password, app_key=my_app_key, certs=certs_path) trading.login()
Code:
CertsError Traceback (most recent call last) ~\Anaconda3\lib\site-packages\betfairlightweight\endpoints\login.py in request(self, method, params, session) 37 try: ---> 38 response = session.post(self.url, data=self.data, headers=self.client.login_headers, cert=self.client.cert) 39 except ConnectionError: ~\Anaconda3\lib\site-packages\betfairlightweight\baseclient.py in cert(self) 154 if cert is None or key is None: --> 155 raise CertsError(certs) 156 return [cert, key] CertsError: Certificate folder not found in C:/certs During handling of the above exception, another exception occurred: APIError Traceback (most recent call last) <ipython-input-19-b1974ee2ecba> in <module> 21 certs=certs_path) 22 ---> 23 trading.login() ~\Anaconda3\lib\site-packages\betfairlightweight\endpoints\login.py in __call__(self, session, lightweight) 28 :rtype: LoginResource 29 """ ---> 30 (response, elapsed_time) = self.request(self.url, session=session) 31 self.client.set_session_token(response.get('sessionToken')) 32 return self.process_response(response, LoginResource, elapsed_time, lightweight) ~\Anaconda3\lib\site-packages\betfairlightweight\endpoints\login.py in request(self, method, params, session) 40 raise APIError(None, exception='ConnectionError') 41 except Exception as e: ---> 42 raise APIError(None, exception=e) 43 elapsed_time = (datetime.datetime.utcnow() - date_time_sent).total_seconds() 44 APIError: None Params: None Exception: Certificate folder not found in C:/certs
HTML Code:
The library can then be used as follows: >>> import betfairlightweight >>> trading = betfairlightweight.APIClient('username', 'password', app_key='app_key', certs='/certs') >>> trading.login()
or the following for interactive login (no certs) >>> trading.login_interactive()
Cheers
Rob


Comment