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
a56171cd
Commit
a56171cd
authored
Jun 17, 2022
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Versión 1.0
parent
640e0a1c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
25 deletions
+15
-25
cli.py
cli.py
+2
-1
test.py
test.py
+13
-24
No files found.
cli.py
View file @
a56171cd
...
...
@@ -510,6 +510,7 @@ def synchronize():
perform_migration
()
synchronize_payment_method
()
update_a2billing_balance
()
update_plan_consumption
()
# Recargas
total_refills
,
amount
=
process_refills
()
...
...
@@ -529,7 +530,7 @@ def synchronize():
@app.command
()
def
test
():
print
(
a2billing
.
account_data
(
'956
810498
'
))
print
(
a2billing
.
account_data
(
'956
384412
'
))
# update_a2billing_balance()
...
...
test.py
View file @
a56171cd
import
pyodbc
import
mariadb
as
mdb
from
a2billing.a2billing
import
account_data
import
os
sql_server_hostname
=
"192.168.2.200"
sql_server_database
=
"bdd_wifi"
sql_server_username
=
"api-mbilling"
sql_server_password
=
"mbillingmbilling"
sql_server_driver
=
'ODBC Driver 17 for SQL Server'
if
os
.
name
==
'nt'
else
'FreeTDS'
DB_CREDENTIALS
=
{
'host'
:
'192.168.2.84'
,
'user'
:
'scripts'
,
'password'
:
'scripts'
,
'port'
:
3306
,
'database'
:
'mbilling'
}
# Cadena de Conexión
SQL_SERVER_CNX_STRING
=
"DRIVER={driver};SERVER={server};
\
DATABASE={database};UID={username};PWD={password};TDS_Version=7.0;"
.
format
(
driver
=
sql_server_driver
,
server
=
sql_server_hostname
,
database
=
sql_server_database
,
username
=
sql_server_username
,
password
=
sql_server_password
)
with
pyodbc
.
connect
(
SQL_SERVER_CNX_STRING
)
as
cnx
:
with
mdb
.
connect
(
**
DB_CREDENTIALS
)
as
cnx
:
with
cnx
.
cursor
()
as
cursor
:
cursor
.
execute
(
'SELECT [ID], [DDI]
\
FROM [bdd_wifi].[dbo].[TB_ServicioFijo]
\
WHERE FechaBaja is NULL AND NuevaPlataforma=1
\
ORDER BY UsuarioWifi, UsuarioEXT DESC'
'SELECT id_prefix, rateinitial FROM mbilling.pkg_rate WHERE id_plan=4;'
)
for
ddi
in
cursor
.
fetchall
():
data
=
account_data
(
ddi
[
1
])
for
prefix
in
cursor
.
fetchall
():
cursor
.
execute
(
'
UPDATE [bdd_wifi].[dbo].[TB_ServicioFijo] SET CuentaA2Billing=? WHERE ID=?
'
,
(
data
[
'account'
]
if
data
else
None
,
ddi
[
0
])
'
INSERT INTO pkg_rate (id_plan, id_trunk_group, id_prefix, rateinitial) VALUES (?,?,?,?)
'
,
(
5
,
1
,
prefix
[
0
],
prefix
[
1
])
)
cnx
.
commit
()
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