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 ###
|
||||
.vscode/
|
||||
|
||||
|
||||
### Python ###
|
||||
__pycache__
|
||||
.pytest_cache
|
25
pom.xml
25
pom.xml
@ -5,7 +5,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.2.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
<relativePath /> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>com.plannaplan</groupId>
|
||||
@ -75,10 +75,31 @@
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</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>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
<modules>
|
||||
<modules>
|
||||
<module>buisnesslogic</module>
|
||||
<module>restservice</module>
|
||||
</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