Serialize as a header for an HTTPAuth request.
(self, realm='')
| 160 | return parameters |
| 161 | |
| 162 | def to_header(self, realm=''): |
| 163 | """Serialize as a header for an HTTPAuth request.""" |
| 164 | auth_header = 'OAuth realm="%s"' % realm |
| 165 | # Add the oauth parameters. |
| 166 | if self.parameters: |
| 167 | for k, v in self.parameters.iteritems(): |
| 168 | if k[:6] == 'oauth_': |
| 169 | auth_header += ', %s="%s"' % (k, escape(str(v))) |
| 170 | return {'Authorization': auth_header} |
| 171 | |
| 172 | def to_postdata(self): |
| 173 | """Serialize as post data for a POST request.""" |