Script to get token - checkpoint
This commit is contained in:
parent
db0115280f
commit
bdfed57942
5
.gitignore
vendored
5
.gitignore
vendored
@ -29,3 +29,8 @@ build/
|
|||||||
|
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
|
||||||
|
### Python ###
|
||||||
|
__pycache__
|
||||||
|
.pytest_cache
|
21
pom.xml
21
pom.xml
@ -75,6 +75,27 @@
|
|||||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>generateSources</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<exec executable="echo">
|
||||||
|
<arg value="xDDD" />
|
||||||
|
</exec>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
35
token.py
Executable file
35
token.py
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
import webbrowser
|
||||||
|
from http.server import BaseHTTPRequestHandler, HTTPServer, SimpleHTTPRequestHandler
|
||||||
|
import urllib.parse as urlparse
|
||||||
|
from urllib.parse import parse_qs
|
||||||
|
import pyperclip
|
||||||
|
import sys
|
||||||
|
# replace with your own http handlers
|
||||||
|
|
||||||
|
|
||||||
|
class S(BaseHTTPRequestHandler):
|
||||||
|
def _set_response(self):
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header('Content-type', 'text/html')
|
||||||
|
self.end_headers()
|
||||||
|
|
||||||
|
def do_GET(self):
|
||||||
|
parsed = urlparse.urlparse(str(self.path))
|
||||||
|
ticket = str(parse_qs(parsed.query)['ticket'][0])
|
||||||
|
print(ticket)
|
||||||
|
pyperclip.copy(ticket)
|
||||||
|
self._set_response()
|
||||||
|
self.wfile.write("Token copied to clipboard".format().encode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
def wait_for_request(server_class=HTTPServer,
|
||||||
|
handler_class=S):
|
||||||
|
server_address = ('localhost', 3000)
|
||||||
|
httpd = server_class(server_address, handler_class)
|
||||||
|
return httpd.handle_request()
|
||||||
|
|
||||||
|
|
||||||
|
url = 'https://cas.amu.edu.pl/cas/login?service=http://localhost:3000&locale=pl'
|
||||||
|
|
||||||
|
webbrowser.open_new_tab(url)
|
||||||
|
wait_for_request()
|
Loading…
Reference in New Issue
Block a user