MobileClient
The MobileClient uses the official SpaceHey API (v1). It is faster and more reliable than the WebClient.
from spacehey import MobileClient
client = MobileClient("YOUR_TOKEN")
Profile Methods
get_self()
Returns your own profile stats and user info.
get_profile(user_id)
Returns profile information for a specific user ID.
update_status(status, mood, you)
Updates the status header on your profile.
-
status: What you are doing.
-
mood: How you are feeling.
-
you: Short intro.
get_profile_editor_data()
Fetches the current raw HTML/CSS from your profile editor textareas. Returns a dictionary. Use this before save_profile to avoid overwriting fields with empty strings.
save_profile(details)
Updates your profile sections and layout.
- details: A dictionary containing keys like about_me, meet, general, music, movies, television, books, heroes, and code (for CSS/Layout).
Social Methods
search_users(query)
Search for users by name.
get_friends(user_id, limit=25, offset=0)
Get a list of friends for a user.
send_friend_request(user_id)
Sends a friend request. Note: The API does not currently require a CAPTCHA.
get_friend_requests()
Returns a list of incoming friend requests.
accept_friend_request(user_id)
Accepts a request.
decline_friend_request(user_id)
Declines a request.
block_user(user_id)
Blocks a user.
Instant Messaging (IM)
get_conversations(page=1)
Returns a list of active DM conversations.
get_messages(user_id, last_time=0, include_user_data=False)
Fetches messages exchanged with a specific user.
send_message(user_id, content)
Sends a direct message to a user.
Content Methods
post_bulletin(subject, content, duration="10d", allow_comments=True)
Posts a new bulletin.
- duration: "1d", "5d", or "10d".
delete_bulletin(bulletin_id)
Deletes a bulletin.
get_blog_posts(category_id=None, limit=25, offset=0)
Gets recent blog posts. If category_id is provided, filters by category.
post_blog_entry(subject, content, category_id, privacy="public", allow_comments=True)
Posts a blog entry.
- privacy: "public", "friends", or "diary".
post_comment(target_type, target_id, text)
Posts a comment.
-
target_type: Usually 'blog' or 'bulletin'.
-
target_id: The ID of the post.