<p>You will have to encode your query params</p>

<pre><code>import urllib.parse
import urllib.request as ur
from bs4 import BeautifulSoup
query = urllib.parse.quote("all:quantum complexity of a black holeu")
url = 'http://export.arxiv.org/api/query?search_query=' + query
s = ur.urlopen(url)
sl = s.read()
soup = BeautifulSoup(sl, 'html.parser')
print(soup)
</code></pre>
Arxiv API not taking the whole query terms
<p>I am using <strong>arxiv API</strong> for scholarly papers search using python. For single term query arxiv API working perfectly well but for multi-term query (Key-phrase), API only took first term. </p>

<p>For example : </p>

<pre><code> import urllib.request as ur
 from bs4 import BeautifulSoup

 url = 'http://export.arxiv.org/api/query?search_query=all:electron'
 s = ur.urlopen(url)
 sl = s.read()
 soup = BeautifulSoup(sl, 'html.parser')
 papers=[soup.find_all('title')]
 print(soup)
</code></pre>

<p>Output(print the soup variable) </p>

<p><a href="https://i.stack.imgur.com/iOxau.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iOxau.png" alt="enter image description here"></a></p>

<p>Here I used query term <strong>electron</strong>, Arxiv API search also electron term (highlighted).</p>

<p>But I used query term say <strong>quantum complexity of a black hole</strong>, arxiv API only took the first word (quantum). </p>

<pre><code>import urllib.request as ur
from bs4 import BeautifulSoup

url = 'http://export.arxiv.org/api/query?search_query=all:quantum complexity of a black hole'
#url='http://export.arxiv.org/api/query?search_query=ti:"quantum complexity of a black hole"&amp;sortBy=lastUpdatedDate&amp;sortOrder=ascending'
s = ur.urlopen(url)
sl = s.read()
soup = BeautifulSoup(sl, 'html.parser')
print(soup)
</code></pre>

<p>Output: 
<a href="https://i.stack.imgur.com/JPVca.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JPVca.png" alt="enter image description here"></a></p>

<p>How can I search using whole key-words (quantum complexity of a black hole) so that it will return the scholarly papers that contain those key-words? </p>