Closed peacing closed 9 years ago
Sorry that XML code didn't come out, here's a screenshot:
Hello @unpairestgood (Paul). Yeah i see what you want to do. It would have been great to have your project open sourced. Anyway
...
response = self.oauth.session.put(url, xmlString[0])
Anyway, kind of late here in. Will try to play with the yahoo fantasy sport API tomorrow if i can. By the way it would be great if i could have a test case.
Have good one buddy
I'm still figuring out how to use github effectively. I uploaded my code in a separate repository (sorry for copying! if that's bad etiquette let me know) https://github.com/unpairestgood/ycontrol-myql-master
Most of my code is in ycontrol.py and then there are a few additions to myql.py. Specifically for this goal in ycontrol I'm calling the function set_hitters which then calls my PUT function. I tried your first suggestions and I couldn't get it to work still. My error is 401 which is supposed to mean the authorization isn't working correctly but I suspect it has to do with how XML code formatting.
That's what my error message looks like. Let me know what I can do to help you have a test case... I'm willing to give you my yahoo username and pass so you can test on my team.
Thanks again
Hi @unpairestgood !
I uploaded my code in a separate repository (sorry for copying! if that's bad etiquette let me know)
The code is under the M.I.T License, so you can almost do whatever you want with it :wink:
If you're working on a Linux or OSX, i think you must have a tools like _virtualenvwrapper and **pip**_. So you could do something like
$ mkvirtualenv ycontrol
$(ycontrol) pip install myql
And you won't need to have a local copy of the libraries you're using :+1:
Most of my code is in ycontrol.py and then there are a few additions to myql.py. Specifically for this goal in ycontrol I'm calling the function set_hitters which then calls my PUT function. I tried your first suggestions and I couldn't get it to work still. My error is 401 which is supposed to mean the authorization isn't working correctly but I suspect it has to do with how XML code formatting.
Thanks for the tips. I went through that a lil bit. I'm trying to reproduce the issue. As soon as i get something, i will let you know.
If you don't mind, i would like to reorganize your project ( less files ). I will externalize the _Yahoo OAuth_ module in a new project, so people will be able to use it as a stand alone library.
Don't hesitate to ask whatsoever questions you may have. One of the greatest goal of open source communities is to learn from/help each other.
Hope to come back to you very soon
Josue,
I'm going to work on finding a solution this weekend... either in my script in Python or I'll try running the repository I linked to above in Node to get something to work. I'm curious if you've looked into this problem more, if you've come close or maybe think it's too difficult to figure out. Let me know!
@unpairestgood , yes i did :wink: I created a OAuth library yahoo-oauth. I just ran tests and they all passed https://travis-ci.org/josuebrunel/yahoo-oauth/builds/65652001
This means that, you won't be using mYQL anymore, since all you need is OAuth credentials. You will have to do stuff like
from yahoo_oauth import OAuth2
oauth = OAuth2(None, None, from_file='creds.json')
# run you requests to the protected api
response = oauth.session.get(uri, params={})
...
response = oauth.session.put(url,data={})
...
response = oauth.session.post(url, data={})
It works just like requests.
By the way, i'm on vacation, i might work on your project if you tell me what you really want to do
Hope it has helped. It's like 3 am here, i need to turn in :sleepy:
Have a good one buddy
Btw, you will need to use REST Api of Fantasy Sport. Here is the Documentation. To better help you, i need to know what you want to do
Thanks
Hello @unpairestgood , Do you use python3 or python2 ? I might be working on your project today. I've read the code and i've planned the actions below :
Thanks
Josue, thanks for the help, try to enjoy your vacation too! So to answer your question, I am using python 2. I'm going to take a look at your code now.
Thanks. Don't worry, even right now i'm coding :wink:
@unpairestgood all my changes are in this pull request. You can reach me on skype if you want : _thehokage
@josuebrunel I implemented those changes... and they worked!! Thank you so much, really! I'm still working in my local copy, but now that the PUT works, I'll spend some time learning how to use the virtual environment and merging/pulling all changes.
Best, Paul
P.S. for the record, my response looked like this:
While it was successful, I'm not sure what the 218 code means.
@unpairestgood so happy for you :wink: . I don't know what the 218 means. But i really happy to see the 200 though lol. Keep it up. As always don't hesitate to bother me if you need anything
Hello Josue,
So, I'm attempting to use the API for more than just GETs, I'm trying to use PUT and POSTs to add functionality (like benching or adding a player on my team) to my fantasy sports specific version of your code. According to the Fantasy Sports documentation (https://developer.yahoo.com/fantasysports/guide/) I should be able to do this... and for example this code (https://github.com/jcreamer898/fantasy-sports) in node.js is apparently capable of doing it.
My attempt so far has been a function that looks like this:
I know this isn't directly related to what you're working on and it will also be difficult for you to test because you need to have a team to make changes... but if you see any obvious error or have any input I appreciate it.
Thanks! Paul