Skip to content
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

Merged
merged 21 commits into from
Mar 19, 2016
Merged

Python 3 support #9

merged 21 commits into from
Mar 19, 2016

Conversation

Half-Shot
Copy link
Collaborator

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

@ara4n
Copy link
Member

ara4n commented Feb 28, 2016

ooh! thanks a lot! we'll take a look in the morning :)

On 28 Feb 2016, at 16:14, Will Hunt notifications@github.com wrote:

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

You can view, comment on, or merge this pull request online at:

#9

Commit Summary

Changed Python version number
Added samples with testing script
Updated api/client to better support python3.
Added simple example for writing a client.
Added help text for script.
Hide inputted password.
Stray f
Minor fixes to help in startSample.sh
File Changes

M README.rst (2)
M matrix_client/api.py (44)
M matrix_client/client.py (14)
A samples/SimpleChatClient.py (75)
A samples/startSample.sh (11)
Patch Links:

https://github.com/matrix-org/matrix-python-sdk/pull/9.patch
https://github.com/matrix-org/matrix-python-sdk/pull/9.diff

Reply to this email directly or view it on GitHub.

@Half-Shot
Copy link
Collaborator Author

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.
Copy link
Contributor

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

Copy link
Collaborator Author

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.

@Half-Shot
Copy link
Collaborator Author

Okay, made some changes to include support for both versions.

@ara4n
Copy link
Member

ara4n commented Mar 15, 2016

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces please :)

Copy link
Member

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)

@Half-Shot
Copy link
Collaborator Author

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.

@kegsay
Copy link
Member

kegsay commented Mar 16, 2016

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.

@Half-Shot
Copy link
Collaborator Author

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.

@Half-Shot
Copy link
Collaborator Author

Okay, I think that clears it up. Anything I've missed?

else:
print("Check your sever details are correct.")
sys.exit(3)
print(e)
Copy link
Member

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.

@kegsay
Copy link
Member

kegsay commented Mar 17, 2016

Nearly there! Thanks for the fixes :)

@kegsay
Copy link
Member

kegsay commented Mar 19, 2016

LGTM, thanks for all your hard work!

kegsay added a commit that referenced this pull request Mar 19, 2016
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>
@kegsay kegsay merged commit e43db1d into matrix-org:python3 Mar 19, 2016
@Half-Shot
Copy link
Collaborator Author

Thanks for the merge, got there in the end :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants