-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3 support #9
Conversation
Added media upload functions.
ooh! thanks a lot! we'll take a look in the morning :)
|
Yo. Any news? It's been a week. |
@@ -5,7 +5,7 @@ Matrix Client SDK for Python | |||
:target: https://pypi.python.org/pypi/matrix-client/ | |||
:alt: Latest Version | |||
|
|||
This is a Matrix client-server SDK for Python 2.x. | |||
This is a Matrix client-server SDK for Python 3.x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this break Python 2.x compatibility? If not, I’d write Python 2.x and 3.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to make any promises (which is why I put this on the python 3 branch). I can give it a test later.
Okay, made some changes to include support for both versions. |
gah, sorry for dropping this - my bad. @kegsay, can you take a quick look? |
) | ||
return self._send("PUT", path, content) | ||
|
||
# content_type can be a image,audio or video | ||
# extra information should be supplied, see https://matrix.org/docs/spec/r0.0.1/client_server.html | ||
def send_content(self,room_id, item_url,item_name,item_type,extra_information=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces please :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And throughout (e.g. :201
)
Thanks for the feedback. I'll admit, I wrote this as part of a bot so it was probably more messy than I remember. I'll get right on it. |
Overall, these are some nice additional features to have, thanks! Went ahead and tried out the sample client and made sure it works on Python 2.x and Python 3.x as described. As an aside, I'd have preferred it if you had separated this PR into PRs for Python 3 support / media uploading / sample client; so heads up in the future. |
Yeah mistake on my part. I had originally planned to use this internally for my bot, and then figured I might as well commit it back :). Of course, by then it was extremely tangled. |
error output.
Okay, I think that clears it up. Anything I've missed? |
else: | ||
print("Check your sever details are correct.") | ||
sys.exit(3) | ||
print(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line will never be hit because in every case sys.exit()
will be called before which terminates the process immediately. This needs to go above the if
block.
Nearly there! Thanks for the fixes :) |
LGTM, thanks for all your hard work! |
Python 3 support This will update the existing code to work for python 3 where libraries have been moved and syntax has changed. The newish media API has been implemented in the API and client. In addition, a sample Python 3 program has been included. Signed-off-by: Will Hunt <half-shot@molrams.com>
Thanks for the merge, got there in the end :) |
This will update the existing code to work for python 3 where libraries have been moved and syntax has changed.
The newish media API has been implemented in the API and client.
In addition, a sample Python 3 program has been included.
Signed-off-by: Will Hunt half-shot@molrams.com