class xdk.oauth1_auth.OAuth1
OAuth1 authentication handler for the X API.
Parameters
__init__
Initialize OAuth1 authentication.
Parameters
API Key (Consumer Key).
API Secret (Consumer Secret).
Callback URL for OAuth flow.
Access Token (if already obtained).
Access Token Secret (if already obtained).
build_request_header
Build OAuth1 authorization header for API requests.
Parameters
HTTP method (GET, POST, etc.).
Request URL (may include query parameters).
Request body (form-encoded string or empty).
Returns
str
get_access_token
Exchange verifier for access token.
Parameters
OAuth verifier from callback or PIN.
Returns
OAuth1AccessToken
get_authorization_url
Get the authorization URL for OAuth1 flow.
Parameters
Whether to use “Log in with X” flow.
Returns
str
get_request_token
Get request token to start OAuth1 flow.
:returns: Request token with oauth_token and oauth_token_secret.
:rtype: OAuth1RequestToken
Returns
OAuth1RequestToken
start_oauth_flow
Convenience method to start the OAuth1 flow.
Parameters
Whether to use “Log in with X” flow.
Returns
str
class xdk.oauth1_auth.OAuth1AccessToken
OAuth1 access token response.
Parameters
__init__
Initialize OAuth1 access token.
Parameters
The access token.
The access token secret.
class xdk.oauth1_auth.OAuth1RequestToken
OAuth1 request token response.
Parameters
__init__
Initialize OAuth1 request token.
Parameters
The OAuth token.
The OAuth token secret.