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

len(pats) will throws IndexError. if using pats = Patent.objects.filter(title="tennis", issue_date="2010-01-01->2010-02-27") #45

Closed
grimmer0125 opened this issue May 10, 2021 · 2 comments

Comments

@grimmer0125
Copy link
Contributor

grimmer0125 commented May 10, 2021

I modified the example in https://patent-client.readthedocs.io/en/latest/index.html#super-quick-start

Patent.objects.filter(title="tennis", issue_date="2010-01-01->2010-12-31")`

to

pats = Patent.objects.filter(title="tennis", issue_date="2010-01-01->2010-02-27")

Then

len(pats) > 10 # throw error in  self.num_results = int(soup.find_all("i")[1].find_all("strong")[-1].text)
@grimmer0125 grimmer0125 changed the title ran Patent.objects.filter, then len(pats) show IndexError. Also not know how to get the result patent for Patent module ran Patent.objects.filter, then len(pats) show IndexError. Also not know how to get the result patent for Patent module in 2.2.0 May 10, 2021
@grimmer0125 grimmer0125 changed the title ran Patent.objects.filter, then len(pats) show IndexError. Also not know how to get the result patent for Patent module in 2.2.0 ran Patent.objects.filter, then len(pats) throws IndexError. Also not know how to get the result patent for Patent module in 2.2.0 May 10, 2021
@grimmer0125 grimmer0125 changed the title ran Patent.objects.filter, then len(pats) throws IndexError. Also not know how to get the result patent for Patent module in 2.2.0 ran Patent.objects.filter, then len(pats) throws IndexError. if using pats = Patent.objects.filter(title="tennis", issue_date="2010-01-01->2010-02-27") May 10, 2021
@grimmer0125 grimmer0125 changed the title ran Patent.objects.filter, then len(pats) throws IndexError. if using pats = Patent.objects.filter(title="tennis", issue_date="2010-01-01->2010-02-27") len(pats) will throws IndexError. if using pats = Patent.objects.filter(title="tennis", issue_date="2010-01-01->2010-02-27") May 10, 2021
@parkerhancock
Copy link
Owner

Thank you for your interest in Patent Client! I don't think this is an issue any longer. The Readme assigns the result to the pats variable. Let me know if this isn't right, and I'm happy to revisit.

@grimmer0125
Copy link
Contributor Author

grimmer0125 commented May 26, 2021

Hi @parkerhancock ,

My previous description is not clear. I tried the same query condition on patft and there is only one search result. The special thing is that it will automatically redirect to the patent page. If using a python script to query, the result is a small html page contains single document this word and the patent URL listed inside but it is not the predicted result page. Therefore, it will throw an exception here

            self.num_results = int(soup.find_all("i")[1].find_all("strong")[-1].text)

I made some workaround code here which is not beautiful and just as a reference, grimmer0125@8943ca9#diff-b6dbafaca666db361cb7b2b2266719b822e2dcecd53671c5f29dcf92a6590799R158

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

2 participants