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

Migrating from Python2.7 to 3.4 #172

Closed
refayathaque opened this issue Apr 23, 2018 · 1 comment
Closed

Migrating from Python2.7 to 3.4 #172

refayathaque opened this issue Apr 23, 2018 · 1 comment

Comments

@refayathaque
Copy link

We are looking to refactor our codebase utilizing your older pshtt library based on Python2.7. Before doing so, we wanted to know if there is anything important we will need to know.

IE Do we still invoke pshtt this way? pshtt.inspect_domains([url], {})[0]

Thank you!

@refayathaque
Copy link
Author

refayathaque commented May 8, 2018

Figured it out.

pshtt_results = pshtt.inspect_domains([url], {})

Actually triggers the work.
pshtt_results = list(pshtt_results)
List is a built-in Python function, it forces a Python iterator (which is what results is when it's returned from pshtt) to evaluate the entire iterator and convert it into a full list of items.
Once you do list(pshtt_results) you will have a Python list of results like you were expecting from the old code (pshtt running on python2). You can return the entire thing, take the first one, or do whatever you want with it.

pshtt_results = pshtt_results[0]

Comments above are taken from: #149

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

No branches or pull requests

1 participant