mirror of
https://github.com/thegeneralist01/twitter-openapi
synced 2026-01-11 15:40:26 +01:00
commit
699bab694a
5 changed files with 50 additions and 23 deletions
5
dist/compatible/schemas/user.yaml
vendored
5
dist/compatible/schemas/user.yaml
vendored
|
|
@ -165,10 +165,7 @@ components:
|
||||||
- entities
|
- entities
|
||||||
- fast_followers_count
|
- fast_followers_count
|
||||||
- favourites_count
|
- favourites_count
|
||||||
- follow_request_sent
|
|
||||||
- followed_by
|
|
||||||
- followers_count
|
- followers_count
|
||||||
- following
|
|
||||||
- friends_count
|
- friends_count
|
||||||
- has_custom_timelines
|
- has_custom_timelines
|
||||||
- is_translator
|
- is_translator
|
||||||
|
|
@ -178,12 +175,10 @@ components:
|
||||||
- muting
|
- muting
|
||||||
- name
|
- name
|
||||||
- normal_followers_count
|
- normal_followers_count
|
||||||
- notifications
|
|
||||||
- pinned_tweet_ids_str
|
- pinned_tweet_ids_str
|
||||||
- possibly_sensitive
|
- possibly_sensitive
|
||||||
- profile_image_url_https
|
- profile_image_url_https
|
||||||
- profile_interstitial_type
|
- profile_interstitial_type
|
||||||
- protected
|
|
||||||
- screen_name
|
- screen_name
|
||||||
- status
|
- status
|
||||||
- statuses_count
|
- statuses_count
|
||||||
|
|
|
||||||
5
dist/docs/schemas/user.yaml
vendored
5
dist/docs/schemas/user.yaml
vendored
|
|
@ -165,10 +165,7 @@ components:
|
||||||
- entities
|
- entities
|
||||||
- fast_followers_count
|
- fast_followers_count
|
||||||
- favourites_count
|
- favourites_count
|
||||||
- follow_request_sent
|
|
||||||
- followed_by
|
|
||||||
- followers_count
|
- followers_count
|
||||||
- following
|
|
||||||
- friends_count
|
- friends_count
|
||||||
- has_custom_timelines
|
- has_custom_timelines
|
||||||
- is_translator
|
- is_translator
|
||||||
|
|
@ -178,12 +175,10 @@ components:
|
||||||
- muting
|
- muting
|
||||||
- name
|
- name
|
||||||
- normal_followers_count
|
- normal_followers_count
|
||||||
- notifications
|
|
||||||
- pinned_tweet_ids_str
|
- pinned_tweet_ids_str
|
||||||
- possibly_sensitive
|
- possibly_sensitive
|
||||||
- profile_image_url_https
|
- profile_image_url_https
|
||||||
- profile_interstitial_type
|
- profile_interstitial_type
|
||||||
- protected
|
|
||||||
- screen_name
|
- screen_name
|
||||||
- status
|
- status
|
||||||
- statuses_count
|
- statuses_count
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,10 @@ components:
|
||||||
- "entities"
|
- "entities"
|
||||||
- "fast_followers_count"
|
- "fast_followers_count"
|
||||||
- "favourites_count"
|
- "favourites_count"
|
||||||
- "follow_request_sent"
|
# 31 # - "follow_request_sent"
|
||||||
- "followed_by"
|
# 31 # - "followed_by"
|
||||||
- "followers_count"
|
- "followers_count"
|
||||||
- "following"
|
# 31 # - "following"
|
||||||
- "friends_count"
|
- "friends_count"
|
||||||
- "has_custom_timelines"
|
- "has_custom_timelines"
|
||||||
- "is_translator"
|
- "is_translator"
|
||||||
|
|
@ -102,12 +102,12 @@ components:
|
||||||
- "muting"
|
- "muting"
|
||||||
- "name"
|
- "name"
|
||||||
- "normal_followers_count"
|
- "normal_followers_count"
|
||||||
- "notifications"
|
# 31 # - "notifications"
|
||||||
- "pinned_tweet_ids_str"
|
- "pinned_tweet_ids_str"
|
||||||
- "possibly_sensitive"
|
- "possibly_sensitive"
|
||||||
- "profile_image_url_https"
|
- "profile_image_url_https"
|
||||||
- "profile_interstitial_type"
|
- "profile_interstitial_type"
|
||||||
- "protected"
|
# 31 # - "protected"
|
||||||
- "screen_name"
|
- "screen_name"
|
||||||
- "status"
|
- "status"
|
||||||
- "statuses_count"
|
- "statuses_count"
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,17 @@ def get_kwargs(key, additional):
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def error_dump(e):
|
||||||
|
if ERROR_UNCATCHED:
|
||||||
|
raise
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
logger.error("==========[STACK TRACE]==========")
|
||||||
|
for trace in traceback.format_exc().split("\n"):
|
||||||
|
logger.error(trace)
|
||||||
|
logger.info("================================")
|
||||||
|
|
||||||
|
|
||||||
api_conf = pt.Configuration(
|
api_conf = pt.Configuration(
|
||||||
api_key={
|
api_key={
|
||||||
"ClientLanguage": "en",
|
"ClientLanguage": "en",
|
||||||
|
|
@ -123,15 +134,27 @@ for x in [pt.DefaultApi, pt.TweetApi, pt.UserApi, pt.UsersApi, pt.UserListApi]:
|
||||||
time.sleep(SLEEP_TIME)
|
time.sleep(SLEEP_TIME)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if ERROR_UNCATCHED:
|
error_dump(e)
|
||||||
raise
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
logger.error("==========[STACK TRACE]==========")
|
|
||||||
for trace in traceback.format_exc().split("\n"):
|
|
||||||
logger.error(trace)
|
|
||||||
logger.info("================================")
|
|
||||||
error_count += 1
|
error_count += 1
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
logger.info(f"Try: Self UserByScreenName Test")
|
||||||
|
kwargs = get_kwargs("UserByScreenName", {"screen_name": "a810810931931"})
|
||||||
|
res = pt.UserApi(api_client).get_user_by_screen_name(**kwargs).to_dict()
|
||||||
|
if not res["data"]["user"]["result"]["legacy"]["screen_name"] == "a810810931931":
|
||||||
|
raise Exception("UserByScreenName failed")
|
||||||
|
except Exception as e:
|
||||||
|
error_dump(e)
|
||||||
|
error_count += 1
|
||||||
|
|
||||||
|
try:
|
||||||
|
logger.info(f"Try: Self UserTweets Test")
|
||||||
|
kwargs = get_kwargs("UserTweets", {"userId": "1180389371481976833"})
|
||||||
|
pt.TweetApi(api_client).get_user_tweets(**kwargs)
|
||||||
|
except Exception as e:
|
||||||
|
error_dump(e)
|
||||||
|
error_count += 1
|
||||||
|
|
||||||
if error_count > 0:
|
if error_count > 0:
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,20 @@ class SchemasCheck(SchemasHookBase):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
class RequiredCheck(SchemasHookBase):
|
||||||
|
def hook(self, value: dict):
|
||||||
|
required = value.get("required", [])
|
||||||
|
|
||||||
|
for key, property in value.get("properties", {}).items():
|
||||||
|
if key in required and property.get("default") is not None:
|
||||||
|
print(f"{key} is required and has default value")
|
||||||
|
d = property.get("default") is None and property.get("nullable", False)
|
||||||
|
if property not in required and d:
|
||||||
|
print(f"{key} is not required and has no default value")
|
||||||
|
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
# RequestHookBase extends
|
# RequestHookBase extends
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue