Starting partial API documentation
Implement simple HTTP request object based on urllib
This commit is contained in:
parent
82075e11e2
commit
b2660a7e03
5 changed files with 63 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
logs/
|
||||
*.pyc
|
||||
__pycache__/
|
||||
database.db
|
1
apidoc/images.md
Normal file
1
apidoc/images.md
Normal file
|
@ -0,0 +1 @@
|
|||
Endpoint: https://www.planetromeo.com/img/usr/original/0x0/URL_TOKEN.jpg (where URL_TOKEN is from the message object)
|
5
apidoc/login.md
Normal file
5
apidoc/login.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
Endpoint: https://www.planetromeo.com/api/v4/session?lang=en
|
||||
|
||||
Payload: {"username":"LOGIN_USER","password":"LOGIN_PASSWORD","keep_login":false}
|
||||
|
||||
Sample Response: {"user_id":"USER_ID","username":"LOGIN_USER","session_id":"SESSION_ID","online_status":"ONLINE","is_plus":true,"is_free_plus":false,"payment_group":"A","confirmed_account":true}
|
47
apidoc/messages.md
Normal file
47
apidoc/messages.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
Endpoint: https://www.planetromeo.com/api/v4/messages?lang=en&length=MESSAGES_COUNT
|
||||
|
||||
Headers:
|
||||
|
||||
* X-Api-Key: vuEp8o93b34CxUCljSMFEdhI70qDWtuk (seems to be hard-coded)
|
||||
* X-Site: planetromeo (might not be necessary, leaving it in anyway)
|
||||
* X-Session-Id: SESSION_ID (from login)
|
||||
|
||||
Sample response:
|
||||
|
||||
{
|
||||
"cursors":{
|
||||
(This should be irrelevant if MESSAGES_COUNT is high enough – there doesn't seem to be a limit for that)
|
||||
},
|
||||
"items":[
|
||||
{
|
||||
"to":"RECIPIENT_ID",
|
||||
"text":"TEXT_CONTENT",
|
||||
"attachments":[
|
||||
{
|
||||
"type":"IMAGE",
|
||||
"error_text":"This App is outdated and cannot support all message features. Please log in to on www.planetromeo.com or update to the most recent App version.",
|
||||
"params":{
|
||||
"id":"ATTACHMENT_ID",
|
||||
"owner_id":"ATTACHMENT_SENDER (usually equals SENDER_ID)",
|
||||
"url_token":"URL_TOKEN",
|
||||
"auth_token":"AUTH_TOKEN (seems irrelevant)"
|
||||
"width":IMAGE_WIDTH (int),
|
||||
"height":IMAGE_HEIGHT (int),
|
||||
"rating":"IMAGE_RATING",
|
||||
"is_public":ATTACHMENT_PUBLIC (bool, usually false?)
|
||||
}
|
||||
},
|
||||
(More attachment objects)
|
||||
],
|
||||
"id":"MESSAGE_ID",
|
||||
"from":"SENDER_ID",
|
||||
"date":"2000-01-01T12:00:00+0000",
|
||||
"expires":"2000-01-08T12:00:00+0000",
|
||||
"folder":"MESSAGE_FOLDER",
|
||||
"unread":READ_STATUS (bool),
|
||||
"locked":LOCKED_STATUS (?, bool),
|
||||
"spam":SPAM_STATUS (bool)
|
||||
},
|
||||
(More message objects)
|
||||
]
|
||||
}
|
6
http.py
Normal file
6
http.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from urllib.request import Request as UrllibRequest
|
||||
|
||||
class Request(UrllibRequest):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.headers["user-agent"] = "romeotools (https://kumig.it/kumitterer/romeotools)"
|
Loading…
Reference in a new issue