Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
scrapper-portabilidad
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Javier
scrapper-portabilidad
Commits
1f8ab889
Commit
1f8ab889
authored
Jun 22, 2022
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conexión con MagnusBilling
parent
a56171cd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
connector.py
mbilling/connector.py
+33
-0
No files found.
mbilling/connector.py
0 → 100644
View file @
1f8ab889
from
sqlalchemy
import
create_engine
,
select
from
sqlalchemy.orm
import
sessionmaker
import
pathlib
import
re
from
dotenv
import
dotenv_values
from
sqlalchemy.ext.automap
import
automap_base
# CONFIGURACIÓN
# Path de MBILLING
mbapi_path
=
pathlib
.
Path
(
pathlib
.
Path
()
.
resolve
(),
'mbilling'
)
# Petición Correcta
succesful
=
re
.
compile
(
r'^\[20\d\]'
)
# Carga de Variables ENV
values
=
dotenv_values
(
pathlib
.
Path
(
mbapi_path
,
'.env'
))
# Conexión a Base de Datos
Base
=
automap_base
()
engine
=
create_engine
(
f
"mariadb+pymysql://{values['DB_USER']}:{values['DB_PASSWORD']}@{values['DB_HOST']}/{values['DB_NAME']}?charset=utf8mb4"
)
Base
.
prepare
(
engine
,
reflect
=
True
)
Session
=
sessionmaker
(
bind
=
engine
)
session
=
Session
()
# Carga de Tablas
User
=
Base
.
classes
.
pkg_user
Sip
=
Base
.
classes
.
pkg_sip
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment