Skip to content

Search query can lead to a 403 Client Error: Forbidden for url #5

@manouchk38

Description

@manouchk38

Hi,

The following query search lead to a 403 Client Error: Forbidden for url whereas searching in joplin gives a correct result

Step to reproduce
`from joppy.api import Api

api = Api(token='xxx')

q='"https://books.google.com.br/books?id=vaZFBgAAQBAJ&pg=PA83&dq=lakatos+copernicus&hl=pt-BR&sa=X&ved=0ahUKEwjewoWZ6q7hAhUNJ7kGHdy5CZUQ6AEIUDAF#v=onepage&q=lakatos%20copernicus&f=false"'

api.search(query=q)`

I may miss some specific knowledge or should have read a documentation that may help me solve this issue.

The context of the problem is the following. I was using an alternative solution for my program that helps me remove semantically identical notes which was to split body at each special character and search for the longuest line in the obtain list of string but it leads small search query and more than 2 notes in many cases so that I cannot finalize the elimination of doublons I have in joplin. Here what I was doing to remove special characters:

`
import re

notelines=re.split(r'[`-=~!@#$%^&*()_+[]{};'\:"|<,./<>?]', note['body'])

q='"'+max(notelines,key=len)+'"'

identicalnotes=api.search(query=q)
`

I reverted to:

`
notelines=note['body'].replace('(',' ').replace(')',' ').replace('[',' ').replace(']',' ').replace('"',' ').split('\n')

q='"'+max(notelines,key=len)+'"'

identicalnotes=api.search(query=q)
`

The error reported here is based on this "filtering" out of '(', ')', '[', ']' and '"'. If remove other special characters found in http link like '%' or '#', I would loose to much "informations".

(inserting code mode seems not to work properly. I had to include two line breaks in order to make it readable.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions