title: Error querying messages by its rfc822msgid
body: <p>I'm trying to get a message by its Message-ID. The Gmail API has no <strong>get()</strong> method to pass the Message-ID in, so I have to <strong>list()</strong> first passing the <strong>q</strong> parameter as given below:</p>
  
  <pre><code>q="rfc822msgid:%s" % message_id
  </code></pre>
  
  <p>The response brings a list with a single message, just as hoped. Then I use the <strong>get()</strong> method to retrieve the message by its <em>Google style</em> identifier. This works like a charm, unless the Message-ID contains a <strong>+</strong> character:</p>
  
  <pre><code>message_id="a+b@c"
  </code></pre>
  
  <p>In this case, the Google Api Client requests this URL:</p>
  
  <pre><code>url="https://www.googleapis.com/gmail/v1/users/me/messages?q=rfc822msgid%3Aa+b%40c&amp;alt=json"
  </code></pre>
  
  <p>I think the client is doing a <strong>quote_plus()</strong> with <strong>safe="+"</strong> to avoid the encoding of the <strong>+</strong> character. But this causes a problem in the commented cases, because the server interprets the <strong>+</strong> character as an space one, so the Message-ID is no more valid:</p>
  
  <pre><code>message_id="a b@c"
  </code></pre>
  
  <p>I tried to switch the <strong>+</strong> character for its quoted representation (<strong>%2B</strong>), but when the client encodes the URL, the Message-ID becomes quite worst due to the <strong>quote(quote())</strong>:</p>
  
  <pre><code>message_id="a%252Bb%40c"
  </code></pre>
  
  <p>So, is there a way to send the <strong>+</strong> character avoiding the server to decode it as a space character?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT:</strong> I was working on the solutions commented here with no positive result. But since a few days ago, my original code started to work. I've not changed a single line, so I think Google has fixed something related this. Thanks for the comments.</p>