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
|
33
pom.xml
33
pom.xml
@ -2,11 +2,11 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.2.2.RELEASE</version>
|
<version>2.2.2.RELEASE</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath /> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.plannaplan</groupId>
|
<groupId>com.plannaplan</groupId>
|
||||||
<artifactId>backend</artifactId>
|
<artifactId>backend</artifactId>
|
||||||
@ -75,10 +75,31 @@
|
|||||||
<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>
|
||||||
<modules>
|
<modules>
|
||||||
<module>buisnesslogic</module>
|
<module>buisnesslogic</module>
|
||||||
<module>restservice</module>
|
<module>restservice</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
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