jetblack_tweeter.types

class AbstractTweeterSession

Summary

The abstract class for Tweeter sessions.

Description

Implement this class to provide clients for the http library of your choice.

jetblack_tweeter.AbstractTweeterSession() -> None

async method AbstractTweeterSession.close

Summary

Close the connection.

async AbstractTweeterSession.close() -> Any

Returns

Any:

async method AbstractTweeterSession.delete

Summary

Delete data in Twitter

async AbstractTweeterSession.delete(
url: str,
headers: Mapping[str, str],
body: Optional[str],
timeout: Optional[float]
) -> Optional[Union[List[Any], Mapping[str, Any]]]

Parameters

url: str

The url

headers: Mapping[str, str]

The HTTP headers

body: Optional[str]

The body (if any),

timeout: Optional[float]

An optional timeout.

Returns

Optional[Union[List[Any], Mapping[str, Any]]]: The unpacked JSON response (if any).

async method AbstractTweeterSession.get

Summary

Get data from Twitter

async AbstractTweeterSession.get(
url: str,
headers: Mapping[str, str],
timeout: Optional[float]
) -> Union[List[Any], Mapping[str, Any]]

Parameters

url: str

The url

headers: Mapping[str, str]

The HTTP headers.

timeout: Optional[float]

An optional timeout.

Returns

Union[List[Any], Mapping[str, Any]]: The unpacked JSON response.

async method AbstractTweeterSession.post

Summary

Post data to Twitter

async AbstractTweeterSession.post(
url: str,
headers: Mapping[str, str],
body: Optional[str],
timeout: Optional[float]
) -> Optional[Union[List[Any], Mapping[str, Any]]]

Parameters

url: str

The url

headers: Mapping[str, str]

The HTTP headers.

body: Optional[str]

The body (if any).

timeout: Optional[float]

An optional timeout.

Returns

Optional[Union[List[Any], Mapping[str, Any]]]: The unpacked JSON response (if any).

async method AbstractTweeterSession.put

Summary

Put data to Twitter

async AbstractTweeterSession.put(
url: str,
headers: Mapping[str, str],
body: Optional[str],
timeout: Optional[float]
) -> Optional[Union[List[Any], Mapping[str, Any]]]

Parameters

url: str

The url

headers: Mapping[str, str]

The HTTP headers

body: Optional[str]

The body (if any)

timeout: Optional[float]

An optional timeout.

Returns

Optional[Union[List[Any], Mapping[str, Any]]]: The unpacked JSON response (if any).

method AbstractTweeterSession.stream

Summary

Stream data

AbstractTweeterSession.stream(
url: str,
method: str,
headers: Mapping[str, str],
body: Optional[str]
) -> AsyncIterator[Union[List[Any], Mapping[str, Any]]]

Parameters

url: str

The url

method: str

The HTTP method

headers: Mapping[str, str]

The HTTP headers

body: Optional[str]

The body (if any)

Returns

AsyncIterator[Union[List[Any], Mapping[str, Any]]]: An async iterator of the unpacked JSON message.

class AbstractHttpClient

Summary

The abstract class for HTTP clients.

jetblack_tweeter.AbstractHttpClient() -> None

async method AbstractHttpClient.close

Summary

Close the connection.

async AbstractHttpClient.close() -> Any

Returns

Any:

async method AbstractHttpClient.delete

Summary

Delete data from Twitter.

async AbstractHttpClient.delete(
url: str,
params: Optional[Mapping[str, Any]],
timeout: Optional[float]
) -> Optional[Union[List[Any], Mapping[str, Any]]]

Parameters

url: str

The url

params: Optional[Mapping[str, Any]] (optional)

The params if any. Defaults to None.

timeout: Optional[float] (optional)

The timeout if any. Defaults to None.

Returns

Optional[Union[List[Any], Mapping[str, Any]]]: The unpacked JSON response if any

async method AbstractHttpClient.get

Summary

Gets data from Twitter.

async AbstractHttpClient.get(
url: str,
params: Optional[Mapping[str, Any]],
timeout: Optional[float]
) -> Union[List[Any], Mapping[str, Any]]

Parameters

url: str

The url.

params: Optional[Mapping[str, Any]] (optional)

The parameters if any. Defaults to None.

timeout: Optional[float] (optional)

The timeout if any. Defaults to None.

Returns

Union[List[Any], Mapping[str, Any]]: The unpacked JSON response.

async method AbstractHttpClient.post

Summary

Post data to Twitter.

async AbstractHttpClient.post(
url: str,
params: Optional[Mapping[str, Any]],
timeout: Optional[float]
) -> Optional[Union[List[Any], Mapping[str, Any]]]

Parameters

url: str

The url

params: Optional[Mapping[str, Any]] (optional)

The params if any. Defaults to None.

timeout: Optional[float] (optional)

Returns

Optional[Union[List[Any], Mapping[str, Any]]]: The unpacked JSON response if any

async method AbstractHttpClient.put

Summary

Put data to Twitter.

async AbstractHttpClient.put(
url: str,
params: Optional[Mapping[str, Any]],
timeout: Optional[float]
) -> Optional[Union[List[Any], Mapping[str, Any]]]

Parameters

url: str

The url

params: Optional[Mapping[str, Any]] (optional)

The params if any. Defaults to None.

timeout: Optional[float] (optional)

Returns

Optional[Union[List[Any], Mapping[str, Any]]]: The unpacked JSON response if any

method AbstractHttpClient.stream

Summary

Stream data from Twitter

AbstractHttpClient.stream(
url: str,
data: Optional[Mapping[str, Any]],
method: str
) -> Coroutine[Any, Any, AsyncIterator[Union[List[Any], Mapping[str, Any]]]]

Parameters

url: str

The url

data: Optional[Mapping[str, Any]] (optional)

The data. Defaults to None.

method: str (optional)

The HTTP method. Defaults to 'post'.

Returns

Coroutine[Any, Any, AsyncIterator[Union[List[Any], Mapping[str, Any]]]]: An async iterator of unpacked JSON responses.