def set_thumbnail(self, thumbnail):
headers = {<EOL>"<STR_LIT>": "<STR_LIT>".format(self._client.token),<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>}<EOL>if not isinstance(thumbnail, bytes):<EOL><INDENT>with open(thumbnail, '<STR_LIT:rb>') as f:<EOL><INDENT>thumbnail = f.read()<EOL><DEDENT><DEDENT>result = requests.put('<STR_LIT>'.format(self._client.base_url,<EOL>OAuthClient.api_endpoint.format(id=self.id)),<EOL>headers=headers, data=thumbnail)<EOL>if not result.status_code == <NUM_LIT:200>:<EOL><INDENT>errors = []<EOL>j = result.json()<EOL>if '<STR_LIT>' in j:<EOL><INDENT>errors = [ e['<STR_LIT>'] for e in j['<STR_LIT>'] ]<EOL><DEDENT>raise ApiError('<STR_LIT>'.format(result.status_code, errors), json=j)<EOL><DEDENT>return True<EOL>
Sets the thumbnail for this OAuth Client.  If thumbnail is bytes,
uploads it as a png.  Otherwise, assumes thumbnail is a path to the
thumbnail and reads it in as bytes before uploading.