1. Fields in shapefiles

  2. How to avoid entering the credentials everytime?

Fields in shapefiles

The following codes is usually used to retrieve shapefiles:

rshp = shapefile.Reader(filename)
shapes = rshp.shapes()
records = rshp.records()

records contains metadata about each shape. Fields and values are not stored in a dictionary. Here is a snippet of code to do so:

{k[0]: v for k, v in zip(rshp.fields[1:], records[0])}

Here is an example of the results:

{'ORD_PRE_DI': 'SW',
'ORD_STREET': '149TH',
'ORD_STRE_1': 'ST',
'ORD_SUF_DI': b'  ',
'R_ADRS_FRO': 976,

(original entry : data_geo_streets.py:docstring of ensae_projects.datainc.data_geo_streets.shapely_records, line 10)

How to avoid entering the credentials everytime?

System Message: INFO/1 (somewhere/workspace/ensae_projects/ensae_projects_UT_37_std/_doc/sphinxdoc/source/ensae_projects/automation/credentials_helper.py:docstring of ensae_projects.automation.credentials_helper.set_password, line 29); backlink

Duplicate explicit target name: “keyring”.

Using clear credentials in a program file or in a notebook is dangerous. You should do that. However, it is annoying to type his password every time it is required. The solution is to store it with keyring. You need to execute only once:

keyring.set_password("k1", "k2", "value")

And you can retrieve the password anytime not necessarily in the same program:

keyring.set_password("k1", "k2", "value")

(original entry : credentials_helper.py:docstring of ensae_projects.automation.credentials_helper.set_password, line 7)