This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from API import Get, Post | |
import requests | |
class Login(Post): | |
def __init__(self, phone_number: str): | |
super().__init__() | |
self.url = "https://somedomain.com/login" | |
self.headers = { | |
"Content-Type": "application/json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun toCurlRequest(request: Request): String? { | |
val builder = StringBuilder("curl -v ") | |
// Method | |
builder.append("-X ").append(request.method).append(" \\\n ") | |
// Headers | |
for ((key, value1) in request.headers) { | |
builder.append("-H \"").append(key).append(":") | |
for (value in value1) builder.append("").append(value) | |
builder.append("\" \\\n ") | |
} |
OlderNewer