Python zakupki gov ru

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A script that loads data from zakupki.gov.ru

apavelm/zakupki

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Zakupki (закупки) is my personal project. The purpose of the project is research of data that the Russian government provides on government procurement. Right now it is a single Python script (in multiple files) that loads the data (zipped XML at ftp://free:free@ftp.zakupki.gov.ru/ ) into MongoDB . MongoDB is used because the data is too irregular for relational databases.

update.py all|inc> [-H --mongodb-host, -P --mongodb-port] [-mu --mongodb-user, -mp --mongodb-password] [-c --contracts, -p --products, -o --organizations]

First argument is the type of update.

  • all does full update — drops collections and loads all available data.
  • inc does incremental update. It searches maximum publish date in the corresponding collection (by region, if the data is divided this way) and loads the data that is published since that max date. If there is no data in the corresponding document group, inc loads all available date.

If you have no data in your MongoDB , there’s no difference between all and inc .

You can also provide host address and port if your MongoDB is not running on localhost . And username-password if you MongoDB uses authentication.

The other arguments are collections to load. If the user provides no additional arguments, all available document types are loaded.

# load all data on products (OKDP classification) to the local mongodb # (no authentication) python update.py all -p # make an incremental update of all available data on server `x.x.x.x`, port `15146`, # username `putin` and password `medvedev` python update.py inc -H x.x.x.x -P 15146 -mu putin -mp medvedev

The script runs on Python 2.7 and has two dependencies: lxml and pymongo .

apt-get install python-dev libxml2-dev libxslt-dev pip install lxml

And, of course, you have to install MongoDB . Current version of the script requires mongodb-10gen version 2.4.6 , you can find installation instructions (for Linux Ubuntu) here: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

If you are short on time, just run this to install the latest version:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list sudo apt-get update sudo apt-get install mongodb-10gen

You can find information about document contents and FTP server folder structure as well as basic document search at http://zakupki.gov.ru/ the official website.

Additional info on the the script structure can be found in my (rather poor) comments.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Script for parsing zakupki.gov.ru

bigboiii300/Goszakupki_parser

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

  1. Скачиваем python, если у вас его нет. 123
  2. Запускаем инсталятор и ставим все галочки как на скрине 123
  3. Открываем командну строку (заходим в поиск и вводим ‘командная строка’, либо используем миллион других способов, которые легко загуглить) 1234
  4. Вводим в командную каждую строку из тех, что можно увидеть ниже (ВАЖНО: Вводим построчно и после каждого ввода нажимаем Enter и ожидаем загрузки пакета. Затем повторяем действие еще 8 раз)
pip3 install requests pip3 install python-docx pip3 install aspose.words pip3 install bs4 pip3 install docx pip3 install py7zr pip3 install pyunpack pip3 install pandas pip3 install openpyxl 
  1. Копируем файлы в любую папку (наличие файла urls.txt обязательно, как и его название)123
  2. Открываем файл и ждем некоторое количество времени. Зависит от количества ссылок, которые нужно обработать, а также от степени нагруженности на госзакупки 123
  3. После запуска появится файл logs.txt, в котором указаны некорректные ссылки(ссылки другого формата или отсутствие документов для загрузки), а также папка content, в которую скачиваются документы для дальнейшей обработки. Папку не нужно трогать и обижать потому что может что-то пойти не так. 123
  4. После завершения обработки content удаляется вместе со всеми скачанными файлами и появляется файл data.xlsx, в котором находится итоговая информация 123

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Homyakin / ZakupkiParser Public archive

License

Homyakin/ZakupkiParser

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

На данный момент реализована выгрузка планов закупки, договоров и извещений о закупке с ftp сервера.

Инструкция по запуску (убедитесь, что используете ветку master)

Разработка ведется на Java 17. (Я использую данный JDK)

В данной программе используется база данных MySQL и есть два способа ее настройки:

Устанавливаем базу данных MySQL обычным способом. В интернете есть много инструкций для этого.

ВАЖНО! Пароль для пользователя root должен быть 12345.
В противном случае заходим в файл src/main/resources/application.yml и меняем 12345 на свой пароль.
Также пароль нобходимо сменить в файле open_data/insert_from_file.py

После установки необходимо подключиться к базе данных и выполнить скрипт из файла database/docker/sql/create_db.sql

2. Docker (только для тех, кто знает что это)

Заходим в папку database/docker и запускаем файл docker.sh.

Перед парсингом необходимо заполнить базу данных табличными данными. Для этого переходим в папку open_data/ и запускаем скрипт insert_all.py. Вам понадобится библиотека pymysql

Открываем проект в вашей среде разработки (Я рекомендую IntelliJ IDEA от Jetbrains) и настраиваем проект Maven (IntelliJ IDEA скорее всего сделает это самостоятельно при открытие папки с проектом).
Все что вам остается это зайти в src/main/java/ru/homyakin/zakupki/Application.java и запустить программу.
Вы можете выбрать какие именно папки и регионы вам нужны перед началом загрузки, а также выбрать промежуток времени. ВАЖНО время файла определяется по его последнему изменению, поэтому в выгрузке за 2020 год могут оказаться файлы, созданные в 2019 году.

Алгоритм программы устроен так, что лучше выгружать несколько папок или регионов одновременно, так как в этом случае имеется возможность параллельной обработки данных. Одну папку в рамках одного региона можно обрабатывать исключительно последовательного.
В application.yml можно указать сколько одновременно папок можно обрабатывать, по-умолчанию — 15.

Источник

Читайте также:  Python typing instance class
Оцените статью