response code acquired
This commit is contained in:
parent
7de09b98ff
commit
d5fe96c7cf
@ -1,19 +1,17 @@
|
||||
import requests
|
||||
from http.server import *
|
||||
import webbrowser
|
||||
import http.server
|
||||
from oauthlib.oauth2 import WebApplicationClient
|
||||
import webbrowser
|
||||
import re
|
||||
import requests
|
||||
|
||||
|
||||
class SavingRequestHandler(SimpleHTTPRequestHandler):
|
||||
class SavingRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
print(self.path)
|
||||
def do_POST(self):
|
||||
content_length = int(self.headers.get('Content-Length'))
|
||||
print(self.rfile.read(content_length))
|
||||
SavingRequestHandler.response_path = self.path
|
||||
|
||||
|
||||
def wait_for_request(server_class=HTTPServer,
|
||||
handler_class=SavingHTTPRequestHandler):
|
||||
def wait_for_request(server_class=http.server.HTTPServer,
|
||||
handler_class=SavingRequestHandler):
|
||||
server_address = ('', 5635)
|
||||
httpd = server_class(server_address, handler_class)
|
||||
return httpd.handle_request()
|
||||
@ -35,3 +33,5 @@ def authenticate():
|
||||
wait_for_request()
|
||||
|
||||
authenticate()
|
||||
response_code = re.search('code=(.*)&state=', SavingRequestHandler.response_path).group(1)
|
||||
print("this is the way ->", response_code)
|
Loading…
Reference in New Issue
Block a user