|
1 | 1 | """Credential classes used to perform authenticated interactions with Twitter""" |
2 | 2 |
|
3 | 3 | from prefect.blocks.core import Block |
4 | | -from pydantic import Field, SecretStr |
| 4 | +from pydantic import VERSION as PYDANTIC_VERSION |
| 5 | + |
| 6 | +if PYDANTIC_VERSION.startswith("2."): |
| 7 | + from pydantic.v1 import Field, SecretStr |
| 8 | +else: |
| 9 | + from pydantic import Field, SecretStr |
| 10 | + |
5 | 11 | from tweepy import API, OAuth1UserHandler |
6 | 12 |
|
7 | 13 |
|
@@ -31,16 +37,16 @@ class TwitterCredentials(Block): |
31 | 37 | _documentation_url = "https://prefecthq.github.io/prefect-twitter/credentials/#prefect_twitter.credentials.TwitterCredentials" # noqa |
32 | 38 |
|
33 | 39 | consumer_key: str = Field( |
34 | | - default=..., description="Twitter App API key used for authentication." |
| 40 | + ..., description="Twitter App API key used for authentication." |
35 | 41 | ) |
36 | 42 | consumer_secret: SecretStr = Field( |
37 | | - defualt=..., description="Twitter App API secret used for authentication." |
| 43 | + ..., description="Twitter App API secret used for authentication." |
38 | 44 | ) |
39 | 45 | access_token: str = Field( |
40 | | - default=..., description="Oauth token used to access the Twitter API." |
| 46 | + ..., description="Oauth token used to access the Twitter API." |
41 | 47 | ) |
42 | 48 | access_token_secret: SecretStr = Field( |
43 | | - default=..., description="Ouath secret used to access the Twitter API." |
| 49 | + ..., description="Ouath secret used to access the Twitter API." |
44 | 50 | ) |
45 | 51 |
|
46 | 52 | def get_api(self) -> API: |
|
0 commit comments